diff --git a/solidworks-api/document/delete-model-equations/Macro.vba b/solidworks-api/document/delete-model-equations/Macro.vba index ba96df51..5caada0a 100644 --- a/solidworks-api/document/delete-model-equations/Macro.vba +++ b/solidworks-api/document/delete-model-equations/Macro.vba @@ -8,6 +8,9 @@ Sub main() Set swApp = Application.SldWorks +try_: + On Error GoTo catch_ + Set swModel = swApp.ActiveDoc Dim hasDeleted As Boolean @@ -16,7 +19,7 @@ Sub main() If swModel.GetType = swDocumentTypes_e.swDocASSEMBLY Then - If MsgBox("Do you want to delete equations in all components of the assembly?", vbYesNo) = vbYes Then + If swApp.SendMsgToUser2("Do you want to delete equations in all components of the assembly?", swMessageBoxIcon_e.swMbQuestion, swMessageBoxBtn_e.swMbYesNo) = swMessageBoxResult_e.swMbHitYes Then Dim swAssy As SldWorks.AssemblyDoc Set swAssy = swModel @@ -59,6 +62,12 @@ Sub main() swModel.ForceRebuild3 False End If + GoTo finally_ + +catch_: + swApp.SendMsgToUser2 Err.Description, swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk +finally_: + End Sub Sub DeleteEquationsFromModel(model As SldWorks.ModelDoc2, ByRef hasDeleted As Boolean) @@ -94,4 +103,4 @@ Function IsEquationBroken(eqMgr As SldWorks.EquationMgr, index As Integer) As Bo IsEquationBroken = (eqMgr.Status = STATUS_BROKEN) -End Function \ No newline at end of file +End Function