Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi!
I am trying to add a custom item to the menu bar in Excel when a specific workbook opens, with code as listed below. The code runs without problems if I execute it after the workbook has been opened, but I get an error message if I paste and run the code in the Workbook_Open procedure. Error message is typical Error 438 or Object variable not set. I have tried to declare the variable at a few different places with no luck. Any suggestions? Johann Code extract ************ Sub Macro2() Dim VWSMenu As Object Dim VWSSub1 As Object Dim VWSSub2 As Object Set VWSMenu = CommandBars("Worksheet Menu Bar").Controls. Add(Type:=msoControlPopup, Befo=11, Temporary:=True) With VWSMenu .Caption = "VWS &Menu" End With Set VWSSub1 = CommandBars("Worksheet Menu Bar").Controls ("VWS Menu") With VWSSub1 .Controls.Add(Type:=msoControlPopup, Befo=1).Caption = "Leads List" End With etc.************** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom Menu Help | Excel Worksheet Functions | |||
Creating Menu to open workbook | Excel Worksheet Functions | |||
Custom Menu | Excel Programming | |||
Custom Menu | Excel Programming |