How to figure out which right-click context menu is appearing whenclicking shape/picture

D

dave.cuthill

I have recently converted to 2007 from 2003 and have a problem with
accessing the commands on the right click menu for a grouped shape.
This code used to work but now it appears as though another menu is
appearing and I don't believe that "pictures context menu" is it
either. So the question is how to determine the name of the menu I
see?

Application.CommandBars("Shapes").Reset

Dim CB As CommandBar
Dim Ctrl As CommandBarControl

Set CB = .CommandBars("Shapes")

For Each Ctrl In CB.Controls
Ctrl.Delete
Next
Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
With Ctrl
.Caption = "Insert Picture"
.OnAction = "CompInsert"
.FaceId = 295
End With
Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
With Ctrl
.Caption = "Delete Picture"
.OnAction = "CompDelete"
.FaceId = 292
End With
 
H

Homey

i think popup menus in excel 07 not same as before. you see their font color
is blu but if you make old popup show like by CommandBars("cell").ShowPopup
you see font is black. i think MS change something here and maybe users can
no more change popup menus.

Also if you list all popups and there controls you dont see any that match
new menus

Sub ListPopups()
Dim CB As CommandBar
Dim Ctrl As CommandBarControl
Dim RowCounter As Integer
Dim ColCounter As Integer
For Each CB In CommandBars
If CB.Type = msoBarTypePopup Then
RowCounter = RowCounter + 1
Cells(RowCounter, 1).Value = CB.Name
ColCounter = 1
For Each Ctrl In CB.Controls
ColCounter = ColCounter + 1
Cells(RowCounter, ColCounter).Value = Ctrl.Caption
Next
End If
Next
End Sub



|I have recently converted to 2007 from 2003 and have a problem with
| accessing the commands on the right click menu for a grouped shape.
| This code used to work but now it appears as though another menu is
| appearing and I don't believe that "pictures context menu" is it
| either. So the question is how to determine the name of the menu I
| see?
|
| Application.CommandBars("Shapes").Reset
|
| Dim CB As CommandBar
| Dim Ctrl As CommandBarControl
|
| Set CB = .CommandBars("Shapes")
|
| For Each Ctrl In CB.Controls
| Ctrl.Delete
| Next
| Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
| With Ctrl
| .Caption = "Insert Picture"
| .OnAction = "CompInsert"
| .FaceId = 295
| End With
| Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
| With Ctrl
| .Caption = "Delete Picture"
| .OnAction = "CompDelete"
| .FaceId = 292
| End With
 
D

dave.cuthill

If that is the case then is there a way to deactivate the right click
menu for shapes/pictures. I can get it to work on the cells on the
sheet by setting cancel=true in the beforerightclick procedure for the
worksheet but it does not have any affect on the shapes/pictures on
the sheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top