Disable Menu Items

J

James

I am currently using vba to disable menu items, using the
Application.CommandBars syntax, for example:
Application.CommandBars("Edit").Controls(2).Enabled = 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).Enabled = False
but I am getting an error "obejct variable not set" run time 91
Thanks
 
G

Gary Brown

Put the disable command [Application.CommandBars("Edit").Controls(2).Enabled
= False] in the "Private Sub Workbook_Activate()" procedure of the
'ThisWorkbook' and the enable command
[Application.CommandBars("Edit").Controls(2).Enabled = True] in the "Private
Sub Workbook_Deactivate()" of the 'ThisWorkbook'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top