ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using CommandBars with Insert Menu (https://www.excelbanter.com/excel-programming/435005-using-commandbars-insert-menu.html)

James

Using CommandBars with Insert Menu
 
This is a very strange problem. I am using the syntax
Application.CommandBars("Insert").Controls(5).Enab led = False to disable menu
items
It works for all the menu items (Edit, Tools, Format, Data,Window) except
the Insert Menu.
I cannot disable the Insert...Worksheet Menu Item
This used to work. Now it returns an error "Subscript out of range"
Control(5) and beyond for the Insert Menu all return an error.
Furthermore these are the Captions that are returned for the 1st 4 controls
of the Insert commandbars (using Caption property)
Calculated &Field...
Calculated &Item...
&Solve Order...
&List Formulas

I would expect to see Cell, Rows, Worksheet, Chart

The funny thing, again, this used to work.

Any help would be greatly appreciated.

Thanks!

Ron de Bruin

Using CommandBars with Insert Menu
 
Use the ID of the control

Start here
http://www.rondebruin.nl/menuid.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"James" wrote in message
...
This is a very strange problem. I am using the syntax
Application.CommandBars("Insert").Controls(5).Enab led = False to disable
menu
items
It works for all the menu items (Edit, Tools, Format, Data,Window) except
the Insert Menu.
I cannot disable the Insert...Worksheet Menu Item
This used to work. Now it returns an error "Subscript out of range"
Control(5) and beyond for the Insert Menu all return an error.
Furthermore these are the Captions that are returned for the 1st 4
controls
of the Insert commandbars (using Caption property)
Calculated &Field...
Calculated &Item...
&Solve Order...
&List Formulas

I would expect to see Cell, Rows, Worksheet, Chart

The funny thing, again, this used to work.

Any help would be greatly appreciated.

Thanks!



Mike H

Using CommandBars with Insert Menu
 
James,

This works for me

Application.CommandBars("Worksheet Menu Bar").Controls("&Insert").Enabled =
False

Mike

"James" wrote:

This is a very strange problem. I am using the syntax
Application.CommandBars("Insert").Controls(5).Enab led = False to disable menu
items
It works for all the menu items (Edit, Tools, Format, Data,Window) except
the Insert Menu.
I cannot disable the Insert...Worksheet Menu Item
This used to work. Now it returns an error "Subscript out of range"
Control(5) and beyond for the Insert Menu all return an error.
Furthermore these are the Captions that are returned for the 1st 4 controls
of the Insert commandbars (using Caption property)
Calculated &Field...
Calculated &Item...
&Solve Order...
&List Formulas

I would expect to see Cell, Rows, Worksheet, Chart

The funny thing, again, this used to work.

Any help would be greatly appreciated.

Thanks!



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

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