Inventor VBA oDoc.Save Does not work

Inventor VBA oDoc.Save Does not work

isocam
Collaborator Collaborator
557 Views
1 Reply
Message 1 of 2

Inventor VBA oDoc.Save Does not work

isocam
Collaborator
Collaborator

Can anybody help?

 

Can somebody try the following VBA code, using Inventor, to see if the document actually saves?

 

Public Function SaveDocument()

    Dim oDoc As Document

    Set oDoc = ThisApplication.ActiveDocument

    oDoc.Save
End Function

 

Please try  it on "iam", "ipt" & "Idw".

 

I am running the macro, but, if you look at the file (date & time) properties using "File Explorer" you should (hopefully) see the time & date change. It does not seem to actually save the document when I try!

Is anybody getting the same result???

 

Many thanks in advance!

Darren

0 Likes
558 Views
1 Reply
Reply (1)
Message 2 of 2

HideoYamada
Advisor
Advisor

Hello,

 

The document will be saved only when the Dirty property is true.

 

So you want to overwrite the file even if the document is not dirty,

should set the Dirty property true.

 

Public Function SaveDocument()

    Dim oDoc As Document

    Set oDoc = ThisApplication.ActiveDocument
    ' Make oDoc dirty.
    oDoc.Dirty = True

    oDoc.Save
End Function

Best Regards,

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes