Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Enabling/Disabling SubMenuItems on the Menu Bar

I have created a custom menu item for the application being created in Excel
via VB code. However, I'm wanting to disable one of the submenu items until
a certain worksheet is selected or perhaps just make it invisible until this
said worksheet is selected. I'm rather new to VB coding but not to coding by
any stretch. Can anyone provide a short example of how do this from another
code module than the one which created the menu and submenu items? I'm sure
I'm not doing the explicit notation correctly and I should be able to just
call the right submenu item by name, id, or perhaps tag without looping
through them all, right?

Thanks,

Bryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Enabling/Disabling SubMenuItems on the Menu Bar

Hi Bryan

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

For the workbook run the code in this two events in the ThisWorkbook module

Read more about events on Chip Pearson's site.
http://www.cpearson.com/excel/events.htm


Private Sub Workbook_Activate()
'your code to change Enabled to False
'Or the name of your macro
End Sub

Private Sub Workbook_Deactivate()
'your code to change Enabled to True
'Or the name of your macro
End Sub






--
Regards Ron de Bruin
http://www.rondebruin.nl



"Type of Sheet displayed" wrote in message
...
I have created a custom menu item for the application being created in Excel
via VB code. However, I'm wanting to disable one of the submenu items until
a certain worksheet is selected or perhaps just make it invisible until this
said worksheet is selected. I'm rather new to VB coding but not to coding by
any stretch. Can anyone provide a short example of how do this from another
code module than the one which created the menu and submenu items? I'm sure
I'm not doing the explicit notation correctly and I should be able to just
call the right submenu item by name, id, or perhaps tag without looping
through them all, right?

Thanks,

Bryan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Enabling/Disabling SubMenuItems on the Menu Bar

In the workbook module, this fires routine that creates the menu:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Log_Menu
End Sub

'fires delete_menu routine that removes the menu item if current
workbook/window is deactivated.

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Delete_Menu
End Sub

Private Sub Workbook_Deactivate()
Delete_Menu
End Sub


Type of Sheet displayed wrote:
I have created a custom menu item for the application being created in Excel
via VB code. However, I'm wanting to disable one of the submenu items until
a certain worksheet is selected or perhaps just make it invisible until this
said worksheet is selected. I'm rather new to VB coding but not to coding by
any stretch. Can anyone provide a short example of how do this from another
code module than the one which created the menu and submenu items? I'm sure
I'm not doing the explicit notation correctly and I should be able to just
call the right submenu item by name, id, or perhaps tag without looping
through them all, right?

Thanks,

Bryan


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling and re-enabling the Cell Shortcut menu Peter Rooney Excel Programming 10 April 6th 06 03:23 PM
Disabling and re-enabling the AutoFilter from VBA CFD[_6_] Excel Programming 7 October 17th 05 01:43 AM
Help with Enabling / Disabling Menu Items..! Applewine[_2_] Excel Programming 1 June 13th 05 10:37 PM
Disabling/Enabling Macros HRobertson Excel Programming 2 October 24th 03 04:07 PM
Enabling/Disabling Macros David Excel Programming 6 August 12th 03 06:21 PM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"