Save File Example (VBA)
This example shows how to save a file.
'-----------------------------------------------------------------
' Preconditions: Open a model document.
'
' Postconditions: The model is zoomed to fit in the graphics area,
' and the document is saved.
'------------------------------------------------------------------
Option Explicit
Dim swApp
As SldWorks.SldWorks
Dim swModel
As SldWorks.ModelDoc2
Dim boolstatus
As Boolean
Dim lErrors
As Long
Dim lWarnings
As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
swApp.Visible = True
' Make a change
swModel.ViewZoomtofit2
boolstatus = swModel.Save3(swSaveAsOptions_Silent,
lErrors, lWarnings)
' Errors
Debug.Print ("Errors as defined in swFileSaveError_e: " &
lErrors)
' Warnings
Debug.Print ("Warnings as defined in swFileSaveWarning_e: " &
lWarnings)
End Sub