Solved

Excel, commandbars and charts

Posted on 2002-06-19
10
728 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

622 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