Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

can not able to Saveas using VBA

Anonymous

can not able to Saveas using VBA

Anonymous
Not applicable

Saveas Issue.PNGHi to All.

Can some boy explain me why the error is coming and the solution too.

0 Likes
Reply
564 Views
3 Replies
Replies (3)

imajar
Advisor
Advisor

Documentation says:

Syntax

AssemblyDocument.SaveAsFileName As String, SaveCopyAs As Boolean )

 

 

you need to reference the document you are trying to save ie:  oDoc.SaveAs( FileName, True)

 

Also, there is another forum here called "Inventor Customization" for programming questions where you will probably get quicker and better answers.  Good Luck.


Aaron Jarrett, PE
Inventor 2019 | i7-6700K 64GB NVidia M4000
LinkedIn

Life is Good.
0 Likes

JaneFan
Autodesk
Autodesk

Besides referencing to document to call the method as @imajar mentioned, there is some common syntax tricks in VBA that it supports calling a method in either of the ways, take Document.SaveAs as example: 

1.With parenthesis:  Call Document.SaveAs(Param1, Param2)

2. With paraenthesis: Document.SaveAs Param1, Param2

Code example:

Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
oDoc.SaveAs "c:\temp\aa.iam", False




Jane Fan
Inventor QA Engineer
0 Likes

_dscholtes_
Advocate
Advocate

Given the fact I see various 'End With' statements and a '.Close' statement, leads me to believe the 'SaveAs' command in the red line of code should also precede with a '.

Noticing the fact there's a '.SaveAs' statement commented out above the red line of code and assuming that is done because it didn't work, lends me to believe something's wrong with your 'With' statements.

0 Likes