mightymishra
Board Regular
- Joined
- Oct 18, 2002
- Messages
- 65
Hi All,
I have a piece of code (pasted below) that is not displaying the context menu on shapes, in 2007 (works in 2003).
The "AddRightClick" code adds an item "NEW ITEM", displayed in msgbox using "CheckRighClick" code , however does not show it when right clicked on the shape.
i am not sure if it is possible to get a context menu for shapes in Excel 2007.
CODE:
Sub AddRightClick()
With Application.CommandBars("Shapes")
Set oBtn = .Controls.Add(msoControlButton)
oBtn.Caption = "NEW ITEM"
oBtn.Visible = True
oBtn.Enabled = True
End With
CheckRighClick
End Sub
Sub CheckRighClick()
Dim CBItem As CommandBarControl
Dim Temp As String
For Each CBItem In Application.CommandBars("Shapes").Controls
Temp = Temp + CBItem.Caption & Chr(10)
Next
MsgBox Temp
End Sub
Sub ResetRightClick()
Application.CommandBars("Shapes").Reset
End Sub
Thanks,
Mighty
I have a piece of code (pasted below) that is not displaying the context menu on shapes, in 2007 (works in 2003).
The "AddRightClick" code adds an item "NEW ITEM", displayed in msgbox using "CheckRighClick" code , however does not show it when right clicked on the shape.
i am not sure if it is possible to get a context menu for shapes in Excel 2007.
CODE:
Sub AddRightClick()
With Application.CommandBars("Shapes")
Set oBtn = .Controls.Add(msoControlButton)
oBtn.Caption = "NEW ITEM"
oBtn.Visible = True
oBtn.Enabled = True
End With
CheckRighClick
End Sub
Sub CheckRighClick()
Dim CBItem As CommandBarControl
Dim Temp As String
For Each CBItem In Application.CommandBars("Shapes").Controls
Temp = Temp + CBItem.Caption & Chr(10)
Next
MsgBox Temp
End Sub
Sub ResetRightClick()
Application.CommandBars("Shapes").Reset
End Sub
Thanks,
Mighty