Eightball3
Registered User.
- Local time
- Today, 04:36
- 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!
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!