Option Explicit Public Module FCModule Dim mMainMenu As MainMenu Public Sub AddIn_OnConnect(ByVal flags As FeatureCAM.tagFMAddInFlags) Handles AddIn.OnConnect Application.CommandBars.CreateButton("Utilities", "BulkEdit", 15) End Sub Public Sub AddIn_OnDisConnect(ByVal flags As FeatureCAM.tagFMAddInFlags) Handles AddIn.OnDisConnect Application.CommandBars.DeleteButton("Utilities", "BulkEdit") End Sub Public Sub BulkEdit() ' User may click toolbar button again before closing dialog ' This jams the thread, but I've not yet found a way to set a flag to prevent it ' because the thread exits without giving me a chance to do anything ' For now the user can exit the dialog using the red X(Cancel) and normal operation is restored Dim bars As FMCmdBars, bar As FMCmdBar, ctrl As FMCmdBarCtrl bars = Application.CommandBars bar = bars("Utilities") ctrl = bar.Controls("BulkEdit") 'bar.Visible = False ctrl.Visible = False mMainMenu = New MainMenu mMainMenu.launchDialog() mMainMenu = Nothing ctrl.Visible = True 'bar.Visible = True End Sub End Module