Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The subject is a little misleading. The context menus that are missing
are the menus that popup from the axis, axis titles, legend, and chart title. I am developing an application within Excel. I wanted to disable all keyboard shortcuts, menus, and commandbars. Here is the code that I used to disable the menus and commandbars 'CODE USED TO DISABLE MENUS AND COMMANDBARS Public Sub DeleteMenus() Dim lngError As Long 'error code Dim cbrTemp As CommandBar Dim cbrAll As CommandBars Dim intCounter As Integer 'initialize variables intCounter = 0 'get the commandbars collection Set cbrAll = Application.CommandBars 'cycle through all the commandbars and menus For Each cbrTemp In cbrAll 'check that the menu is enabled If cbrTemp.Enabled = True Then 'counter for appending count to Key name intCounter = intCounter + 1 'save the command bars name to the registry VBA.SaveSetting APPNAME, PRIMARYSECTION & "\" & CMDBARKEY, _ CMDBARSUBKEYS & CStr(intCounter), cbrTemp.Name 'disable the commandbar cbrTemp.Enabled = False End If Next cbrTemp End Sub 'CODE USED TO REINSTALL MENUS AND COMMANDBARS Sub InstallMenus() Dim cbrAll As CommandBars Dim intCounter As Integer Dim varArray As Variant 'get the commandbars collection Set cbrAll = Application.CommandBars 'initialize the counter intCounter = 1 'get all of the commandbar names from the registry varArray = VBA.GetAllSettings(APPNAME, PRIMARYSECTION & "\" & CMDBARKEY) 'loop through the returned set of commandbars For intCounter = LBound(varArray) To UBound(varArray) 'enable the commandbar cbrAll(varArray(intCounter, 1)).Enabled = True 'delete the key from the registry VBA.DeleteSetting APPNAME, PRIMARYSECTION & "\" & CMDBARKEY, CMDBARSUBKEYS & CStr(intCounter + 1) Next intCounter End Sub I store the names of the menus that were originally enabled in the registry; before, the application workbook was opened. So, when the user closes the workbook application, the names of the menus can be restored. Can anyone help me to recover the menus that become visible when the user right-clicks the legend, axis titles, chart title, gridlines, and axes? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well, I've researched and answered my own question. There is a bit of
code (4 lines) that does the trick at the following link... http://www.excelforum.com/showthread.php?t=539152 The code is... dim cb as commandbar for each cb in applications.commandbars cb.enabled = true next cb I would still like to know why the menus in question were not enabled with the code listed. Anybody have a clue? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding commands to the Excel 2007 Chart context menu | Charts and Charting in Excel | |||
Missing menu bar when chart is selected | Charts and Charting in Excel | |||
missing menu when chart is selected | Excel Discussion (Misc queries) | |||
missing menu when chart is selected | Charts and Charting in Excel | |||
context menu | Excel Programming |