Reg : Unknown Error while IDW --> DWG

Reg : Unknown Error while IDW --> DWG

naresh_kalyan
Advocate Advocate
383 Views
6 Replies
Message 1 of 7

Reg : Unknown Error while IDW --> DWG

naresh_kalyan
Advocate
Advocate
Dear all,
I'm geting Error "Invalid Procedure call or orgument"
and when I hit debug and then hit Continue, it's working fine. Please, Can anyone fix this.
------------------------------------------
sFname = odoc.FullFileName
sFname = Left$(sFname, Len(sFname) - 3) & "dwg"
Call odoc.SaveAs(sFname, True)' ERROR line
-------------------------------------------
Thanks in advance.
NKalyan
0 Likes
384 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Does saving to DWG via the 'Save Copy As' command in Inventor generate any
errors? If not, could you post the data set and the code?

Sanjay-

wrote in message news:5583314@discussion.autodesk.com...
Dear all,
I'm geting Error "Invalid Procedure call or orgument"
and when I hit debug and then hit Continue, it's working fine. Please, Can
anyone fix this.
------------------------------------------
sFname = odoc.FullFileName
sFname = Left$(sFname, Len(sFname) - 3) & "dwg"
Call odoc.SaveAs(sFname, True)' ERROR line
-------------------------------------------
Thanks in advance.
NKalyan
0 Likes
Message 3 of 7

naresh_kalyan
Advocate
Advocate
Thanks for the reply... Sanjay. Here is the total code.

Private Sub Command2_Click()
Dim iapp As inventor.Application
Dim odoc As inventor.Document
Dim sFname As String

Set iapp = CreateObject("Inventor.application")
iapp.SilentOperation = True
Set odoc = iapp.Documents.Open("D:\SG422RPN\SG422RPN-DRAWINGS.idw", True)

sFname = odoc.FullFileName
sFname = Left$(sFname, Len(sFname) - 3) & "dwg"
Call odoc.SaveAs(sFname, True)
On Error Resume Next
MsgBox "Finished"
End Sub
0 Likes
Message 4 of 7

Anonymous
Not applicable
I don't see any obvious problems with the code. I'd recommend that you try
the following:

1. Make sure the 'Save Copy As' works fine via the user interface.
2. Add the following 2 lines of code after the Documents.Open call below:
odoc.Views.Item(1).Update
DoEvents
3. Try the code with other drawings.

If you still can't get it to work, we will need the dataset you are working
with so we can investigate the issue.

Sanjay-

wrote in message news:5584694@discussion.autodesk.com...
Thanks for the reply... Sanjay. Here is the total code.

Private Sub Command2_Click()
Dim iapp As inventor.Application
Dim odoc As inventor.Document
Dim sFname As String

Set iapp = CreateObject("Inventor.application")
iapp.SilentOperation = True
Set odoc = iapp.Documents.Open("D:\SG422RPN\SG422RPN-DRAWINGS.idw", True)

sFname = odoc.FullFileName
sFname = Left$(sFname, Len(sFname) - 3) & "dwg"
Call odoc.SaveAs(sFname, True)
On Error Resume Next
MsgBox "Finished"
End Sub
0 Likes
Message 5 of 7

naresh_kalyan
Advocate
Advocate
No Progress.. still same Error.
I dont know about "DATASET". could you plz tell me what it is?
But, atleast... I found why it is happening.
If in "Windows Task Manager", is there any "Inventor.Exe" still running even if I close Inventor.... then the code returning with Error.
If I End the Task manually and run the code, then there is no error.
0 Likes
Message 6 of 7

naresh_kalyan
Advocate
Advocate
Sanjay.... can u plz tell me what is a DATASET ?
0 Likes
Message 7 of 7

Anonymous
Not applicable
The Inventor documents that you are working with. If you can post those
files, we can try to reproduce the issue here.

Sanjay-

wrote in message news:5605626@discussion.autodesk.com...
Sanjay.... can u plz tell me what is a DATASET ?
0 Likes