Uzi,
The routine below will allow you to add menu items to a specific shortcut
menu. You have to provide the name for it.
Usage:
Call AddItemToShortcutMenu("Shapes","RunThis","This is a new item...")
' ==============================================================
' Parameter description
' ShortcutMenuName: Name of the shortcut menu within which the menu item is
to be created
' OnActionMacro: Name of macro to be executed when user selects the menu
item
' Caption: Caption for the menu item.
' ==============================================================
Sub AddItemToShortcutMenu(ShortcutMenuName As String, _
OnActionMacro As String, _
Caption As String)
Dim cbMenuItem As CommandBarButton
Dim cbContainer As CommandBarPopup
On Error Resume Next
Set cbContainer = Application.CommandBars("Shortcut Menus") _
.Controls("Draw").Controls(sName)
If cbContainer Is Nothing Then
MsgBox "Could not find shortcut menu with that name.", vbExclamation
Exit Sub
End If
With cbContainer.Controls
Set cbMenuItem = .Add(Type:=msoControlButton)
With cbMenuItem
.OnAction = OnActionMacro
.Caption = Caption
End With
End With
End Sub
' ==============================================================
--
Regards,
Shyam Pillai
Toolbox:
http://skp.mvps.org/toolbox
There are several shortcut menus which are categorized in the PowerPoint
object model