VBA Skip warning when saving

VBA Skip warning when saving

pball
Mentor Mentor
3,375 Views
9 Replies
Message 1 of 10

VBA Skip warning when saving

pball
Mentor
Mentor

I have a mass print script and I have it save then close the drawing after it's done printing each one. The problem is the script updates the mass properties and some times drawings just update when opened. So when it saves different "warnings" can pop up, which pause the script until the pop up is taken care of. The warnings are typically for saving other files like the ipt linked to a drawing or if the drawing was saved in an old version. Is there a way to just accept those while running a script so it does puase?

 

How I save and then close the drawing.

 

ThisApplication.ActiveEditDocument.Save
ThisApplication.ActiveEditDocument.Close True

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style

Userscript to edit forum links to jump to first unread post
Jump To First Post Userscript
0 Likes
Accepted solutions (1)
3,376 Views
9 Replies
Replies (9)
Message 2 of 10

YuhanZhang
Autodesk
Autodesk
Accepted solution

SilentOperation can suppress Inventor warnings, maybe you want to use this.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 10

pball
Mentor
Mentor

Thanks. I played with this some and it seems to doing just what I need.

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style

Userscript to edit forum links to jump to first unread post
Jump To First Post Userscript
0 Likes
Message 4 of 10

Anonymous
Not applicable

hi,

would you mind sharing your code.

i have the same problem.

can i do it in vb within inventor?

 

 

thanks

inventor 2011

vault 2012

0 Likes
Message 5 of 10

jdkriek
Advisor
Advisor

@Anonymous wrote:

would you mind sharing your code.

i have the same problem.

can i do it in vb within inventor?


 

ThisApplication.SilentOperation = True

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 6 of 10

pball
Mentor
Mentor

And one word of warning. Make sure to set it to False by the time the script finishes. I have some exit subs in the script I did and the setting stayed on after the script was done, if it was exited via the exit sub. So I found an event that fired when the script was done, whether it exited or completed and put set it back to false there.  Depending on what your script is like, you could just ignore what i've said.

 

Private Sub UserForm_Terminate()
    ThisApplication.SilentOperation = False
End Sub

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style

Userscript to edit forum links to jump to first unread post
Jump To First Post Userscript
Message 7 of 10

jdkriek
Advisor
Advisor

Good point, always set back to False 😉

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 8 of 10

Anonymous
Not applicable

where can i do this code , inside inventor?

0 Likes
Message 9 of 10

jdkriek
Advisor
Advisor

Yes, you can use this in iLogic

 

ThisApplication.SilentOperation = True

 

You won't need the VBA script posted by pball for your situation.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 10 of 10

mrattray
Advisor
Advisor

You can set this as a tick box option in the iLogic rule editor as well.

 

Capture.JPG

Mike (not Matt) Rattray

0 Likes