ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shortcut menus in 2007 (https://www.excelbanter.com/excel-programming/419156-shortcut-menus-2007-a.html)

XP

Shortcut menus in 2007
 
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.

Ron de Bruin

Shortcut menus in 2007
 
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.


XP

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.




All times are GMT +1. The time now is 11:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com