ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Menu Items (https://www.excelbanter.com/excel-programming/434980-disable-menu-items.html)

James

Disable Menu Items
 
I am currently using vba to disable menu items, using the
Application.CommandBars syntax, for example:
Application.CommandBars("Edit").Controls(2).Enable d = False
This is having an effect on all of Excel.
Is there a way I can disable it only for the Active Workbook.
I tried this:
ActiveWorkbook.CommandBars("Edit").Controls(2).Ena bled = False
but I am getting an error "obejct variable not set" run time 91
Thanks

Ron de Bruin

Disable Menu Items
 
hi James

See
http://www.rondebruin.nl/menuid.htm

Is there a way I can disable it only for the Active Workbook.


Read also this section
Other useful examples



--

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


"James" wrote in message
...
I am currently using vba to disable menu items, using the
Application.CommandBars syntax, for example:
Application.CommandBars("Edit").Controls(2).Enable d = False
This is having an effect on all of Excel.
Is there a way I can disable it only for the Active Workbook.
I tried this:
ActiveWorkbook.CommandBars("Edit").Controls(2).Ena bled = False
but I am getting an error "obejct variable not set" run time 91
Thanks



Gary Brown[_5_]

Disable Menu Items
 
Put the disable command [Application.CommandBars("Edit").Controls(2).Enable d
= False] in the "Private Sub Workbook_Activate()" procedure of the
'ThisWorkbook' and the enable command
[Application.CommandBars("Edit").Controls(2).Enable d = True] in the "Private
Sub Workbook_Deactivate()" of the 'ThisWorkbook'.
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"James" wrote:

I am currently using vba to disable menu items, using the
Application.CommandBars syntax, for example:
Application.CommandBars("Edit").Controls(2).Enable d = False
This is having an effect on all of Excel.
Is there a way I can disable it only for the Active Workbook.
I tried this:
ActiveWorkbook.CommandBars("Edit").Controls(2).Ena bled = False
but I am getting an error "obejct variable not set" run time 91
Thanks



All times are GMT +1. The time now is 10:22 PM.

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