S
S G Booth
I have an addin which creates its' own menu item on loading, and deletes it
on closing, but an error is raised when I shut excel down.
So I set a break point at the start of the following code:
Sub RemoveBofQ_UtilitiesMenu()
' This sub should be executed when the workbook is 'closed
' Deletes the Menus
Dim MenuSheet As Worksheet
Dim Row As Integer, Caption As String
On Error Resume Next
Set MenuSheet = ThisWorkbook.Sheets _
("BofQUtilitiesMenu")
Row = 2
Do Until IsEmpty(MenuSheet.Cells(Row, 1))
If MenuSheet.Cells(Row, 1) = 1 Then
Caption = MenuSheet.Cells(Row, 2)
Application.CommandBars(1).Controls _
(Caption).Delete
End If
Row = Row + 1
Loop
On Error GoTo 0
End Sub
The sub executes correctly, but when it ends, it jumps into another sub in a
standard module in the addin and runs it,
which raises the error.
How is this 2nd sub being called.....what can I look for,
please?
Regards.
on closing, but an error is raised when I shut excel down.
So I set a break point at the start of the following code:
Sub RemoveBofQ_UtilitiesMenu()
' This sub should be executed when the workbook is 'closed
' Deletes the Menus
Dim MenuSheet As Worksheet
Dim Row As Integer, Caption As String
On Error Resume Next
Set MenuSheet = ThisWorkbook.Sheets _
("BofQUtilitiesMenu")
Row = 2
Do Until IsEmpty(MenuSheet.Cells(Row, 1))
If MenuSheet.Cells(Row, 1) = 1 Then
Caption = MenuSheet.Cells(Row, 2)
Application.CommandBars(1).Controls _
(Caption).Delete
End If
Row = Row + 1
Loop
On Error GoTo 0
End Sub
The sub executes correctly, but when it ends, it jumps into another sub in a
standard module in the addin and runs it,
which raises the error.
How is this 2nd sub being called.....what can I look for,
please?
Regards.