ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   object variable not set with commandbars (https://www.excelbanter.com/excel-programming/393297-object-variable-not-set-commandbars.html)

icccapital

object variable not set with commandbars
 
I have the following code in my workbook_open procedu
CommandBars("worksheet menu bar").Controls().Add(Type:=msoControlPopup,
befo=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.

Jim Cone

object variable not set with commandbars
 

Use: Application.CommandBars
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"icccapital"
wrote in message
I have the following code in my workbook_open procedu
CommandBars("worksheet menu bar").Controls().Add(Type:=msoControlPopup,
befo=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.


All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com