Creating a Custom Shortcut Menu (1 Viewer)

Eightball3

Registered User.
Local time
Yesterday, 16:30
Joined
Jun 30, 2010
Messages
18
I'm working to put together a shortcut menu for a form that will be viewed as a datasheet. I'm trying to put together the vba to create the menu. I'd like a lot of the standard options i.e. sort a-z, filter toggle etc. I'd also like to add the menu option that is displayed in the default menu called "Text Filters". I've been unable to find the id code for that option, and since it, when chosen opens another menu, I'm not real sure how to code it. Here is what I have so far:

Sub CreateWIPShortcutMenu()
Dim cmbRightClick As Office.CommandBar
Dim cmbControl As Office.CommandBarControl

' Create the shortcut menu.
Set cmbRightClick = CommandBars.Add("cmdWIP", msoBarPopup, False, True)

With cmbRightClick
.Controls.Add msoControlButton, 19, , , True 'Copy
.Controls.Add msoControlButton, 141, , , True 'Find
.Controls.Add(msoControlButton, 210, , , True).BeginGroup = True 'New group and Ascending
.Controls.Add msoControlButton, 211, , , True 'Decending
.Controls.Add msoControlButton, 12267, , , True 'Remove Sort
.Controls.Add(msoControlButton, 2764, , , True).BeginGroup = True 'Select Columns
'cmbControl.Caption = "Select Columns"
.Controls.Add(msoControlButton, 601, , , True).BeginGroup = True 'Toggle filter
.Controls.Add msoControlButton, 10068, , , True 'New group and Equals selection
.Controls.Add msoControlButton, 10071, , , True 'Filter Excluding selection
.Controls.Add msoControlButton, 10076, , , True 'Contains Selection
.Controls.Add msoControlButton, 10089, , , True 'Does not contain selection
.Controls.Add msoControlButton, 10090, , , True 'Begins With selection
.Controls.Add msoControlButton, 12265, , , True 'Does not begin with selection
.Controls.Add msoControlButton, 10091, , , True 'Ends with selection
.Controls.Add msoControlButton, 12266, , , True 'Does not end with selection
'.Controls.Add msoControlPane, 13278, , , True
End With

Set cmbRightClick = Nothing
End Sub

I'm hoping that someone else has figured this out and may be able to shed some light!
 

Eightball3

Registered User.
Local time
Yesterday, 16:30
Joined
Jun 30, 2010
Messages
18
Maybe I posted this in the wrong forum, not much action. A picture might help describe what I'm after. I hope the quality is good enough. I'm basically trying to recreate the "Text Filters" option on the menu along with the menu it opens.
 

Attachments

  • menu.jpg
    menu.jpg
    50.9 KB · Views: 707

Eightball3

Registered User.
Local time
Yesterday, 16:30
Joined
Jun 30, 2010
Messages
18
Okay, maybe I can sneak up on this instead. Can someone tell me what that "Text Filters" is on that shortcut menu? Is it a dropdown? A ComboBox? If it is one of these how would I go about incorporating it into my menu above? Any help at all would be appreciated! Thanks!
 

Users who are viewing this thread

Top Bottom