Get Version History Example (VBA)
This example shows how to get the version history of a SolidWorks document.
'------------------------------------------------
'
' Preconditions: A SolidWorks document is open.
'
' Postconditions: None
'
'------------------------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
vVerStr As
Variant
Dim
i As
Long
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Debug.Print
"File = " & swModel.GetPathName
If
IsEmpty(vVerStr) Then
vVerStr
= swApp.VersionHistory(swModel.GetPathName)
End
If
If
Not IsEmpty(vVerStr) Then
For
i = 0 To UBound(vVerStr)
Debug.Print
" "
& vVerStr(i)
Next
i
Else
Debug.Print
" No
version information."
End
If
End Sub
'------------------------------------------------