This simple but effective macro combines the ForceRebuild3 and Save SolidWorks funtions into one useful macro.
It is useful if your drawing views disappear.
This macro will force a rebuild of all of the features in the drawing or model whether they need a rebuild and then save the document.
It is not the same as a normal rebuild which is Ctrl+B on the keyboard which is typically used after changing a model dimension. This is Ctrl+Q
I have replaced the standard save button on the menu bar with this macro. Give it a try
Please click on the panel below to reveal or hide the macro code
'Make sure you have the correct SW Type library attached in the references
'e.g SldWorks 20xx Type Library
'On the menu bar go to Tools then References to locate the library
Sub ForceRebuildAndSave_Main()
Dim swApp As SldWorks.SldWorks
Dim swModelDoc As SldWorks.ModelDoc2
'Connect to SW
Set swApp = Application.SldWorks
'Get active document
Set swModelDoc = swApp.ActiveDoc
With swModelDoc
'Force rebuild
.ForceRebuild3 True
'Re-draw graphics window
.GraphicsRedraw
'Save active document
.Save
End With
End Sub