Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a nutshell, when I click on the menu sub-item "Exit Admin Mode" all the
sub-items are deleted EXCEPT the "Exit Admin Mode" sub-item. If I step through the BuildMoreMenus() routine it WILL delete all sub-items if they are present, including the "Exit Admin Mode" sub-item. Very odd. How can I have that sub-item deleted when I click it? Here's the code that creates and deletes the Help menu sub-items: Code:
Public Const DATA_MENU_ID As Long = 30010 'Help main menu item Code:
Private Sub BuildMoreMenus() Dim NewItem As CommandBarButton, cbItem As CommandBarPopup Call DeleteMoreMenus Set cbItem = Application.CommandBars(1).FindControl(ID:=DATA_MENU_ID) If cbItem Is Nothing Then MsgBox "Cannot add menu item." Exit Sub Else Set NewItem = cbItem.Controls.Add(Type:=msoControlButton) With NewItem .FaceId = 1826 .Caption = "Show All Sheets" .OnAction = "ShowAll" .BeginGroup = True End With Set NewItem = cbItem.Controls.Add(Type:=msoControlButton) With NewItem .FaceId = 1835 .Caption = "Hide All Sheets" .OnAction = "HideAll" .BeginGroup = False End With Set NewItem = cbItem.Controls.Add(Type:=msoControlButton) With NewItem .FaceId = 1640 .Caption = "Exit Admin Mode" .OnAction = "ExitAdmin" .BeginGroup = False End With End If Application.CommandBars(1).FindControl(ID:=HELP_MENU_ID).Tag = "ON" End Sub Public Function ExitAdmin() 'Return workbook to user mode. Call DeleteMoreMenus End Function Public Function DeleteMoreMenus() 'Remove the items from main menu. On Error Resume Next With Application.CommandBars(1).FindControl(ID:=HELP_MENU_ID) .Controls("Show All Sheets").Delete .Controls("Hide All Sheets").Delete .Controls("Exit Admin Mode").Delete 'Doesn't work here. Because it's selected??? .Tag = "OFF" End With End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disable the Delete Control in the Edit Menu | Excel Programming | |||
Problem: Control Toolbox Control resizes when clicked | Excel Programming | |||
Determine last clicked object / control | Excel Programming | |||
How to determine which dynamically generated control was clicked | Excel Programming | |||
Return Index of Control Object Clicked! | Excel Programming |