PC Review


Reply
Thread Tools Rate Thread

Disable Menu Items

 
 
James
Guest
Posts: n/a
 
      15th Oct 2009
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
 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      15th Oct 2009
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" <(E-Mail Removed)> wrote in message
news:A2B0733A-8C07-4EA7-BF07-(E-Mail Removed)...
>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


 
Reply With Quote
 
Gary Brown
Guest
Posts: n/a
 
      15th Oct 2009
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'.
--
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).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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable All Menu Items WildlyHarry Microsoft Access Forms 5 29th Oct 2008 08:02 PM
Disable sub items on a menu bar Rhys Davies Microsoft Access Form Coding 1 4th Dec 2007 05:52 PM
How to disable menu item and its sub menu items? =?Utf-8?B?QW5kcmV3?= Microsoft Dot NET Framework 2 13th Aug 2007 04:46 PM
How to disable a menu item and all its sub menu items? =?Utf-8?B?QW5kcmV3?= Microsoft Dot NET Framework Forms 1 10th Aug 2007 12:36 AM
Is is possible to disable certain menu items Buster Microsoft Excel Programming 1 19th Nov 2004 08:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 AM.