automaticly save an assembly macro

automaticly save an assembly macro

Anonymous
Not applicable
475 Views
3 Replies
Message 1 of 4

automaticly save an assembly macro

Anonymous
Not applicable

I believe this is a stupid question but I just got stuck with it. So please help 🙂

 

I have made a macro that asks for a location on the file server (=client name) and then the project name. It then automatic creates the correct folders, opens my custom assembly template and changes an ipart that is by default in it.

 

That's all great and can save us a ton of time, but the last step is to automatic save the assembly! I just can't get it working and can't find the correct code (programming help, this forum, Google, ...)

 

I have defined the target folder earlier and the file name of the assembly is identical to this folder. For example

target folder = O:\Projects\clientName\ClientProject1

file name = ClientProject1.iam

-> result: O:\Projects\clientName\ClientProject1\ClientProject1.iam

 

the code that I think should work looks like this:

 

Sub SaveAssembly()
    Dim oAssDoc As AssemblyDocument
    Set oAssDoc = ThisApplication.ActiveDocument
    oAssDoc.SaveAs ("O:\Projects\clientName\ClientProject1\ClientProject1.iam", False)
End Sub

 

But it doesn't work, I always get the error message "Compile error: Expected: ="
Whatever I do next I don't get the code to work

 

I feel stupid I can get the diffucult part working but that I'm stuck over something easy as an automatic save ...

 

thx for the help!

 

0 Likes
Accepted solutions (1)
476 Views
3 Replies
Replies (3)
Message 2 of 4

jdkriek
Advisor
Advisor
Accepted solution

You need to Call it 😉

 

Call oAssDoc.SaveAs()

 

Sub SaveAssembly()
    Dim oAssDoc As AssemblyDocument
    Set oAssDoc = ThisApplication.ActiveDocument
    Call oAssDoc.SaveAs ("O:\Projects\clientName\ClientProject1\ClientProject1.iam", False)
End Sub
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 4

Anonymous
Not applicable

I knew I was forgetting something stupid 🙂

 

It works, thx!

0 Likes
Message 4 of 4

jdkriek
Advisor
Advisor

You're quite welcome.

 

Sometimes it's the simple things. Back in PHP I always forgot semicolons lol

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


0 Likes