How to write shortcut menu ? (See attachement) (1 Viewer)

cheer

Registered User.
Local time
Today, 20:10
Joined
Oct 30, 2009
Messages
222
Presently, I have a sub function to create shortcut menu for a table as shown below

Public Sub Menu_Customise_SubForm()
Dim strMenuForm As String
Dim CB As CommandBar
Dim CBS As CommandBarButton

strMenuForm = "Menu_Customise_SubForm"

On Error Resume Next
Application.CommandBars(strMenuForm).Delete

On Error GoTo errHandler
Set CB = Application.CommandBars.Add(strMenuForm, msoBarPopup, False, False)

Set CBS = CB.Controls.Add(msoControlButton, 141, , , True)
CBS.Caption = "Find"

Set CBS = CB.Controls.Add(msoControlButton, 640, , , True)
CBS.Caption = "Filter By Selection"

CBS.BeginGroup = True

Set CBS = CB.Controls.Add(msoControlButton, 3017, , , True)
CBS.Caption = "Filter Excluding Selection"

Set CBS = CB.Controls.Add(msoControlButton, 605, , , True)
CBS.Caption = "Remove Filter / Sort"

'Set CBS = CB.Controls.Add(msoControlButton, 1061, , , True)
'CBS.Caption = "Test1"

'Set CBS = CB.Controls.Add(msoControlButton, 1062, , , True)
'CBS.Caption = "Test2"

Set CBS = CB.Controls.Add(msoControlButton, 210, , , True)
CBS.Caption = "Sort Ascending"

CBS.BeginGroup = True

Set CBS = CB.Controls.Add(msoControlButton, 211, , , True)
CBS.Caption = "Sort Descending"

Set CBS = Nothing
Set CB = Nothing
Exit Sub
errHandler:
End Sub

Can anyone suggest how to add on further extra shortcut menus as shown in the attachment below ?
 

Attachments

  • ShortcutMenu.png
    ShortcutMenu.png
    8.6 KB · Views: 430

Users who are viewing this thread

Top Bottom