Enabling/Disabling SubMenuItems on the Menu Bar

G

Guest

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
 
A

acampbell012

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
 

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