Solved

Excel, commandbars and charts

Posted on 2002-06-19
10
722 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
SendBlaster Pro 4 - Bulk Email Sending Software

SendBlaster 4 Pro - Best Bulk Emailing Sending Software
Automatic Subscribe / Unsubscribe Processing
Great for Newsletters & Mass Mailings
Optional HTML & Text Composition
Integration with Google Features
Built in Spam Score Checking
Free Professional Templates - Feature Packed!

 
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

RoboForm Secure Password Management System

RoboForm Everywhere - Superb Browser Support
Windows / Apple / IOS / Android / Linux / Chrome OS
Use different complex passwords everywhere
Best Secure Password Management by far
Synchronize all of your devices instantly
Safe, Secure & Highly Recommended!

Question has a verified solution.

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

Suggested Solutions

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

752 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