Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Context menu for chart is missing

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Context menu for chart is missing

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
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
Adding commands to the Excel 2007 Chart context menu Andreas Charts and Charting in Excel 1 January 23rd 09 08:15 PM
Missing menu bar when chart is selected Alison Charts and Charting in Excel 8 May 18th 06 03:30 AM
missing menu when chart is selected Alison Excel Discussion (Misc queries) 1 May 11th 06 03:49 AM
missing menu when chart is selected Alison Charts and Charting in Excel 0 May 5th 06 03:29 AM
context menu eric23 Excel Programming 3 May 9th 04 11:49 PM


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

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

About Us

"It's about Microsoft Excel"