I know that this has been covered before, and I have a working macro that creates a menu item in order to run a macro. Here is the code that I'm currently using...
I want this macro to automatically run when the Addin is installed. However, when I create this same macro under Workbook_AddinInstall, I get an error.
The Set NewMenu line is highlighted when I debug. What do I need to change to get it to work automatically?
Also, I would like to create the item before the 'Help' menu item, but all of the Before:= statements that I have tried up to this point have failed. That is by no means a show stopper, it would just be nice.
Any help is appreciated.
TIA
Code:
Private Sub CreateMenu()
Dim NewMenu As CommandBarPopup
Set NewMenu = CommandBars("Worksheet Menu Bar").Controls.Add _
(Type:=msoControlPopup)
With NewMenu
.Caption = "QAD"
.OnAction = "ShowQADForm"
End With
End Sub
I want this macro to automatically run when the Addin is installed. However, when I create this same macro under Workbook_AddinInstall, I get an error.
Code:
Run-time error '91':
Object variable or with block variable not set
The Set NewMenu line is highlighted when I debug. What do I need to change to get it to work automatically?
Also, I would like to create the item before the 'Help' menu item, but all of the Before:= statements that I have tried up to this point have failed. That is by no means a show stopper, it would just be nice.
Any help is appreciated.
TIA