1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Sub CreateReportShortcutMenu()
Dim cmbRightClick As Office.CommandBar
Dim cmbControl As Office.CommandBarControl
' Create the shortcut menu.
Set cmbRightClick = CommandBars.Add("cmdReportRightClick", msoBarPopup, False, True)
With cmbRightClick
' Add the Print command.
Set cmbControl = .Controls.Add(msoControlButton, 2521, , , True)
' Change the caption displayed for the control.
cmbControl.Caption = "Quick Print"
' Add the Print command.
Set cmbControl = .Controls.Add(msoControlButton, 15948, , , True)
' Change the caption displayed for the control.
cmbControl.Caption = "Select Pages"
' Add the Page Setup... command.
Set cmbControl = .Controls.Add(msoControlButton, 247, , , True)
' Change the caption displayed for the control.
cmbControl.Caption = "Page Setup"
' Add the Mail Recipient (as Attachment)... command.
Set cmbControl = .Controls.Add(msoControlButton, 2188, , , True)
' Start a new group.
cmbControl.BeginGroup = True
' Change the caption displayed for the control.
cmbControl.Caption = "Email Report as an Attachment"
' Add the PDF or XPS command.
Set cmbControl = .Controls.Add(msoControlButton, 12499, , , True)
' Change the caption displayed for the control.
cmbControl.Caption = "Save as PDF/XPS"
' Add the Close command.
Set cmbControl = .Controls.Add(msoControlButton, 923, , , True)
' Start a new group.
cmbControl.BeginGroup = True
' Change the caption displayed for the control.
cmbControl.Caption = "Close Report"
End With
Set cmbControl = Nothing
Set cmbRightClick = Nothing
End Sub |
Partager