View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Shortcut menus in 2007


Hi Ron,

Yeah; okay. I had not thought of using a menu control; that works!

Thanks!

"Ron de Bruin" wrote:

Something like this maybe

Sub AddToCellDropDown()
Dim CellDropDown As CommandBar
Dim MyDropDownItem As CommandBarControl

Call RemoveFromCellDropDown

Set CellDropDown = Application.CommandBars("Cell")
With CellDropDown.Controls.Add(Type:=msoControlPopup, befo=1)
.Caption = "My menu"
.Tag = "MyDropDownItem"

With .Controls.Add(Type:=msoControlButton)
.Caption = "Copy to new worksheet"
.OnAction = "Copy_Worksheet"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Copy to new workbook"
.OnAction = "Copy_Workbook"
End With
End With
End Sub

Sub RemoveFromCellDropDown()
Dim MyDropDownItem As CommandBarControl
Set MyDropDownItem = Application.CommandBars.FindControl(Tag:="MyDropDo wnItem")
If Not MyDropDownItem Is Nothing Then
MyDropDownItem.Delete
End If
Set MyDropDownItem = Nothing
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"XP" wrote in message ...
Using Office 2007 and Win XP;

In XL 2007 shortcut menus (right click menus) is it possible to have a
"Title" row that does nothing when clicked but can be used to group the
custom commands?

For example (hopefully this will show up correctly in the news reader),

Formats <<<title/group
Number
Text
Imports <<<title/group
G/L
Payroll

If this is possible, what is the command to create a "Title" or "Group Name"
line?

Thanks much in advance.