Hi,
I'm trying to use Workbook_BeforeClose event to delete my custom menus.
However, when I try to pass the custom menu caption to the Sub, I get a compile error (Expected Function or Variable).
I believe this has something to do with global variables declaration or something...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Run DeleteMenu(cbcCustomMenu.Caption)
End Sub
Sub DeleteMenu(menuName As String)
Dim controlo
For Each controlo In CommandBars("Worksheet Menu Bar").Controls
If controlo.Caption = menuName Then controlo.Delete
Next controlo
'Application.CommandBars("Worksheet Menu Bar").Controls("Macros").Delete
End Sub
Thanks in advance!
Bookmarks