Solved

Excel, commandbars and charts

Posted on 2002-06-19
10
704 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: dandraka
There are several quick shortcuts that can make your life easier in Microsoft Programs.  These simple tips and tricks will your work more productive and you faster at completing your tasks! MS Word (1) Creating Re-usable Scraps You can create s…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now