简体   繁体   中英

Solidworks VBA save as new name

I am currently generating a solidworks part file name from a text document for a batch "rename" of the documents. This assigns sequential numbers to them which i then save each part in a folder as. I have been trying to figure out a method for the new file names to be referenced in the assembly they were a part of.

For saving the document I am using :

swModel.SaveAs3 "" & FileName & "", 0, 0

I have no issue creating all the files in a batch but I could not seem to find a method of apply this save in such a way that any open documents that it is referenced in change to referencing the new part name.

Edit: I figured out a serviceable solution using some of the information held in this link:

help.solidworks

Using the pack and go functionality in solidworks avoids having to deal with the references as they are already handled by the process itself Hope this helps.

Try the below approach:

Dim FileName As String
FileName = "blablabla" & Variable & "blablabla"
swModel.SaveAs3 ("C:\User\Username\Desktop" + FileName + ".SLDPRT", 0, 1)

Variable = Variable + 1
'continue with your loop

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM