Save File Example (VB.NET)
This example shows how to save a file.
'-----------------------------------------------------------------
' Preconditions:
' 1. Open a model.
' 2. Open the Immediate window.
'
' Postconditions:
' 1. Zooms to fit the model in the graphics area.
' 2. Saves the model.
' 3. Examine the graphics area and Immediate window.
'------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Imports System.Diagnostics
Partial Class SolidWorksMacro
Dim swModel As ModelDoc2
Dim boolstatus As Boolean
Dim lErrors As Integer
Dim lWarnings As Integer
Sub main()
swModel = swApp.ActiveDoc
swApp.Visible = True
'
Make a change
swModel.ViewZoomtofit2()
boolstatus = swModel.Save3(swSaveAsOptions_e.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
Public swApp As SldWorks
End Class