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

can not able to Saveas using VBA

Saveas Issue.PNGHi to All.

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

imajar
in reply to: Anonymous

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.
JaneFan
in reply to: imajar

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
_dscholtes_
in reply to: Anonymous

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.