Link to home
Start Free TrialLog in
Avatar of nekm
nekm

asked on

Excel, commandbars and charts

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?


Avatar of Elmo_
Elmo_
Flag of Ireland image

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.
Avatar of nekm
nekm

ASKER

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.
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
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
ASKER CERTIFIED SOLUTION
Avatar of ture
ture

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi nekm, any update on this?
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
Avatar of nekm

ASKER

Sorry, let me check some of them on your list Ture.
LET THE QUESTION BE OPEN MEANWHILE, thanks,
nekm
Avatar of nekm

ASKER

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
thanks for finalizing