Get Last Save Error Example (VBA)
This example shows how to get the last save error.
'-------------------------------------------------------------------
' This example shows how to get the last save error issued
' by Microsoft in the current session.
'
' Preconditions: A
SOLIDWORKS session in which a save error has occurred.
'
' Postconditions: Inspect
the Immediate Window.
'--------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim varPath As String
Dim varError As Long
Dim varMessage As String
Sub main()
Set swApp = Application.SldWorks
varMessage = swApp.GetLastSaveError(varPath,
varError)
If Not varError = 0 Then
Debug.Print
"The document generating the save error was: " & varPath
Debug.Print
"The error code was: " & varError
Debug.Print
"The error message was: " & varMessage
Else
Debug.Print
"This session has not experienced a save error."
End If
End Sub