Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set worksheet Menu bar invisible

Status
Not open for further replies.

cathy68

Programmer
Aug 6, 2003
23
NZ
hi Gurus
I try to set worksheet menu bar invisible in excel. I write the code like this:
Application.Commandbars("Worksheet Menu Bar").Visible = False
in the Workbook_Open() VBA project. it doesn't work.
every time it show a error message:

Run_time error'-2147467259(80004005)':
Method 'Visible' of object 'CommandBar' failed

but if I try
Application.Commandbars("Standard").Visible = False
or any other command bar, it works very well. it looks like only "Worksheet Menu Bar" doesn't work like this way.

is there anyone know why?
 
Try setting its Enabled property instead of Visible property. worksheet menu bar's index is 1. So the code below works.
Application.CommandBars(1).Enabled = False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top