object variable not set with commandbars

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code in my workbook_open procedure:
CommandBars("worksheet menu bar").Controls().Add(Type:=msoControlPopup,
before:=CommandBars("worksheet menu bar").Controls.Count + 1,
temporary:=True).Caption = "Client Reports"

So I am basically trying to add a menu item to "worksheet menu bar". It
worked fine when I tested it in a module after the workbook had opened, but
when I added it to the workbook_open procedure and reopened the workbook I
get this error. I also get it on commandbars(0).name, so are the commandbars
not loaded yet? Is there a way to load them? Thank you.
 
Use: Application.CommandBars
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"icccapital" <[email protected]>
wrote in message
I have the following code in my workbook_open procedure:
CommandBars("worksheet menu bar").Controls().Add(Type:=msoControlPopup,
before:=CommandBars("worksheet menu bar").Controls.Count + 1,
temporary:=True).Caption = "Client Reports"

So I am basically trying to add a menu item to "worksheet menu bar". It
worked fine when I tested it in a module after the workbook had opened, but
when I added it to the workbook_open procedure and reopened the workbook I
get this error. I also get it on commandbars(0).name, so are the commandbars
not loaded yet? Is there a way to load them? Thank you.
 
Back
Top