'VBA
'Preconditions:
'1. Open C:\Users\Public\Documents\SOLIDWORKS\SOLIDWORKS 2019\samples\tutorial\advdrawings\98food processor.sldasm.
'2. Ensure c:\temp exists.
'Postconditions:
'1. Silently saves a copy of the assembly (food_processor_Suff.sldasm) and re-named reference files (*_Suff.sldprt) to c:\temp.
'2. Opens the saved assembly.
'3. Observe the re-named components in the FeatureManager design tree.
' NOTE: Because the model is used elsewhere, do not save changes.
'=========================================
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim boolstatus As Boolean
Dim FileName As String
Dim DIR As String
Dim EXT As String
Dim opt As Long
Dim lErrors As Long
Dim lWarnings As Long
Sub main()
DIR = "c:\temp\"
EXT = ".SLDASM"
Set swApp = Application.SldWorks
swApp.Visible = True
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
'1 = swSaveAsOptions_Silent
'4 = swSaveAsOptions_SaveReferenced
'512 = swSaveAsOptions_CopyAndOpen
opt = 512 + 4 + 1
FileName = DIR & "food_processor_Suff" & EXT
boolstatus = swModelDocExt.SaveAs2(FileName, 0, opt, Nothing, "_Suff", False, lErrors, lWarnings)
End Sub