Gets whether this configuration is dirty (i.e., needs to be updated).
Visual Basic for Applications (VBA)
Option Explicit
Sub main()
Const sLicenseKey As String = "your_license_key" ' Specify your license key
Const sDocFileName As String = "c:\test\Wiper_Plate_Assy.SLDASM" ' Specify your document
Dim swClassFact As SwDocumentMgr.SwDMClassFactory
Dim swDocMgr As SwDocumentMgr.SwDMApplication
Dim swDoc As SwDocumentMgr.SwDMDocument
Dim swCfgMgr As SwDocumentMgr.SwDMConfigurationMgr
Dim vCfgNameArr As Variant
Dim vCfgName As Variant
Dim swCfg As SwDocumentMgr.SwDMConfiguration10
Dim nDocType As Long
Dim nRetVal As Long
Dim i As Long
Dim bRet As Boolean
' Determine type of SOLIDWORKS file based on filename extension
If InStr(LCase(sDocFileName), "sldprt") > 0 Then
nDocType = swDmDocumentPart
ElseIf InStr(LCase(sDocFileName), "sldasm") > 0 Then
nDocType = swDmDocumentAssembly
ElseIf InStr(LCase(sDocFileName), "slddrw") > 0 Then
nDocType = swDmDocumentDrawing
Else
' Probably not a SOLIDWORKS file
nDocType = swDmDocumentUnknown
' So cannot open
Exit Sub
End If
Set swClassFact = CreateObject("SwDocumentMgr.SwDMClassFactory")
Set swDocMgr = swClassFact.GetApplication(sLicenseKey)
Set swDoc = swDocMgr.GetDocument(sDocFileName, nDocType, True, nRetVal): Debug.Assert swDmDocumentOpenErrorNone = nRetVal
Set swCfgMgr = swDoc.ConfigurationManager
Debug.Print "File = " & swDoc.FullName
Debug.Print " ActiveCfgName = " & swCfgMgr.GetActiveConfigurationName
vCfgNameArr = swCfgMgr.GetConfigurationNames
For Each vCfgName In vCfgNameArr
Set swCfg = swCfgMgr.GetConfigurationByName(vCfgName)
Debug.Print vCfgName & " -> Dirty Flag = " & swCfg.IsDirty
Next
End Sub