Solved

Excel, commandbars and charts

Posted on 2002-06-19
10
713 Views
Last Modified: 2008-02-01
What is the name of the right-click popup menu for a chart? I want to add a command. To add something when righ-clicking on a *column* for example:

Set objItem = CommandBars("Column").Controls.Add(msoControlButton, 1, , lngPos, True)

But for charts?


0
Comment
Question by:nekm
10 Comments
 
LVL 3

Expert Comment

by:Elmo_
ID: 7092197
Nekm,

I have found something which might be of use to you.  It shows you how to create and implement a popup menu in excel using VBA.

http://www.bygsoftware.com/examples/PopUpMenuDemo.htm

Cheers,

Ed.
0
 

Author Comment

by:nekm
ID: 7092283
Thanks for the input, but what I want to do is to add my command to an existing, built in commandbar. So I need the name of the popup menu for charts.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7092355
Hi Nekm, you could check

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q166755

it's very long but contains a lot of info on customizing menu's

very busy right now to write something here

HAGD:O)Bruintje
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 3

Expert Comment

by:ehout
ID: 7092385
Hi,

Place the following sub somewhere in an excel module and run it.

In the debug window you should get a list of all available commandbars. I guess your's will be among it.

Sub getbars()
  Dim cbar As CommandBar
                         
  For Each cbar In Application.CommandBars
    Debug.Print cbar.Name
  Next cbar
 
End Sub

Kind regards,
ehout
0
 
LVL 22

Accepted Solution

by:
ture earned 50 total points
ID: 7093339
nekm,

That depends on which part of a chart you are right-clicking on...

To list all right-click-menus, run this procedure:

Sub ShowRightClickMenus()
 
  'Declare a variable
  Dim mnu As CommandBar
                         
  'Loop through all commandbars and list the ones that
  'are right-click menus
  For Each mnu In Application.CommandBars
    If mnu.Position = msoBarPopup Then
      Debug.Print mnu.Name
    End If
  Next mnu
 
End Sub

The resulting list (Excel 2000) is:

Query and Pivot
PivotChart Menu
Workbook tabs
Cell
Column
Row
Cell
Column
Row
Ply
XLM Cell
Document
Desktop
Nondefault Drag and Drop
AutoFill
Button
Dialog
Series
Plot Area
Floor and Walls
Trendline
Chart
Format Data Series
Format Axis
Format Legend Entry
Formula Bar
PivotTable Context Menu
Query
Query Layout
AutoCalculate
Object/Plot
Title Bar (Charting)
Layout
Pivot Chart Popup
Phonetic Information
Shapes
Inactive Chart
Excel Control
Curve
Curve Node
Curve Segment
Pictures Context Menu
OLE Object
ActiveX Control
WordArt Context Menu
Rotate Mode
Connector
Script Anchor Popup
Add Command
Built-in Menus
System


Ture Magnusson
Karlstad, Sweden
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7165650
hi nekm, any update on this?
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7262059
Hello nekm

this question is open for more then 2 months
time to clean up
if not stated otherwise

my recom will be
-PAQ
-points to ture
-this will be finalized by an EE Moderator
-with no further update (11.09.2002)

PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER

HAGD:O)Bruintje
posted by ToolzEE v1.0
0
 

Author Comment

by:nekm
ID: 7263779
Sorry, let me check some of them on your list Ture.
LET THE QUESTION BE OPEN MEANWHILE, thanks,
nekm
0
 

Author Comment

by:nekm
ID: 7263931
OK, worked like a charm with "Plot Area", heres the code I put in an xla: (tack Ture det funkade fint!)

Set objMenuGraph = CommandBars("Plot Area")
Set objItem = objMenuGraph.Controls.Add(msoControlButton, 1, , lngPos, True)
    objItem.OnAction = "Graph_Update"
    objItem.Caption = "Update graph without updating sheet"



Public Sub Graph_Update()
   
    Dim x As Double
    Dim y As Double
    Dim ch As ChartArea
    Dim newCh As ChartArea
    x = ActiveChart.Parent.Left
    y = ActiveChart.Parent.Top
    Set ch = ActiveChart.ChartArea
   
   
    ActiveChart.ChartArea.Select
    ActiveChart.ChartArea.Copy
    ActiveSheet.Cells(1, 1).Select
    ActiveSheet.Paste
    Set newCh = ActiveChart.ChartArea
   
   
    ch.Parent.Parent.Activate
    ActiveWindow.Visible = False
    ch.Parent.Parent.Delete
   
    newCh.Parent.Parent.Left = x
    newCh.Parent.Parent.Top = y
   

End Sub
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7263952
thanks for finalizing
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question