Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub DesTblUpdate()
Dim swDoc As SldWorks.ModelDoc2
Dim swDocXt As SldWorks.ModelDocExtension
Dim DesTbl As SldWorks.DesignTable
Dim swAllDocs As EnumDocuments2
Dim FirstDoc As SldWorks.ModelDoc2
Dim dummy As Boolean
Dim NumDocsReturned As Long
Dim DocCount As Long
Dim DesTblCount As Long
Dim i As Long
Dim DoTheUpdate As Long
Dim sMsg As String
Dim swApp As SldWorks.SldWorks
Dim bDocWasVisible As Boolean
Set swApp = Application.SldWorks
Set swAllDocs = swApp.EnumDocuments2
Set FirstDoc = swApp.ActiveDoc
DocCount = 0
DesTblCount = 0
swAllDocs.Next 1, swDoc, NumDocsReturned
While NumDocsReturned <> 0
Set swDocXt = swDoc.Extension
If swDocXt.HasDesignTable Then
DesTblCount = DesTblCount + 1
End If
swAllDocs.Next 1, swDoc, NumDocsReturned
DocCount = DocCount + 1
Wend
sMsg = DocCount & " Documents, " & DesTblCount & " of which had design tables"
sMsg = sMsg & vbCrLf & vbCrLf & "Do you want to update these tables?"
DoTheUpdate = MsgBox(sMsg, vbYesNo, "Update Design Tables?")
If DoTheUpdate = vbNo Then
Exit Sub
End If
DocCount = 0
DesTblCount = 0
swAllDocs.Reset
swAllDocs.Next 1, swDoc, NumDocsReturned
While NumDocsReturned <> 0
Set swDocXt = swDoc.Extension
If swDocXt.HasDesignTable Then
DesTblCount = DesTblCount + 1
bDocWasVisible = swDoc.Visible
swApp.ActivateDoc swDoc.GetPathName
Set DesTbl = swDoc.GetDesignTable
dummy = DesTbl.Attach
dummy = DesTbl.UpdateTable(swDesignTableUpdateOptions_e.swUpdateDesignTableAll, True)
DesTbl.Detach
swDoc.Visible = bDocWasVisible
End If
swAllDocs.Next 1, swDoc, NumDocsReturned
DocCount = DocCount + 1
Wend
swApp.ActivateDoc FirstDoc.GetPathName
End Sub