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").Cont rols.Add(m soControlB utton, 1, , lngPos, True)
But for charts?
Set objItem = CommandBars("Column").Cont
But for charts?
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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
Sorry, let me check some of them on your list Ture.
LET THE QUESTION BE OPEN MEANWHILE, thanks,
nekm
LET THE QUESTION BE OPEN MEANWHILE, thanks,
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( msoControl Button, 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.Sele ct
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
Set objMenuGraph = CommandBars("Plot Area")
Set objItem = objMenuGraph.Controls.Add(
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.Sele
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
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.