When macro started form is displayed. While form is open all rebuild operations (regenerations) will be suspended.
For example dimension changes or mates will not resolve until Exit Suspend Rebuild Mode button is clicked.
Sub main()
FreezeRebuildForm.Show vbModeless
EndSub
User Form
Const CANCEL_REGEN AsLong = 1
Dim swApp As SldWorks.SldWorks
DimWithEvents swPart As SldWorks.PartDoc
DimWithEvents swAssy As SldWorks.AssemblyDoc
DimWithEvents swDraw As SldWorks.DrawingDoc
PrivateSub btnExit_Click()
EndEndSubPrivateSub UserForm_Initialize()
Set swApp = Application.SldWorks
Dim swModel As SldWorks.ModelDoc2
Set swModel = swApp.ActiveDoc
IfNot swModel IsNothingThenSelectCase swModel.GetType()
Case swDocumentTypes_e.swDocPART
Set swPart = swModel
Case swDocumentTypes_e.swDocASSEMBLY
Set swAssy = swModel
Case swDocumentTypes_e.swDocDRAWING
Set swDraw = swModel
EndSelectElse
MsgBox "Please open the model"EndEndIfEndSubPrivateFunction swAssy_RegenNotify() AsLong
swAssy_RegenNotify = CANCEL_REGEN
EndFunctionPrivateFunction swDraw_RegenNotify() AsLong
swDraw_RegenNotify = CANCEL_REGEN
EndFunctionPrivateFunction swPart_RegenNotify() AsLong
swPart_RegenNotify = CANCEL_REGEN
EndFunction