Private Sub Report_Load()
CreateReportShortcutMenu
End Sub
Private Sub CreateReportShortcutMenu()
'==================================================================================================
'//In the Report_Load Event enter CreateReportShortcutMenu then in the reports Property/Shortcut
' Menu Bar enter the MenuName "vbaShortCutMenu"
'
'//The numbers are Ms Access Control numbers you can download and excel file from MS
'
'//Reference: Microsoft Office 12.0 Object Library
'==================================================================================================
Dim MenuName As String
Dim CB As CommandBar
Dim CBB As CommandBarButton
MenuName = "vbaShortCutMenu"
On Error Resume Next
Application.CommandBars(MenuName).Delete
On Error GoTo 0
'The below code creates the menu I named vbaShortCutMenu
Set CB = Application.CommandBars.Add(MenuName, msoBarPopup, False, False)
'Adds the Print command.
Set CBB = CB.Controls.Add(msoControlButton, 15948, , , True)
CBB.Caption = "Print..."
CBB.Tag = "Print..."
CBB.OnAction = "PrintActiveRptFrm" 'Calls a module
'Adds the Email As .PDF command.
Set CBB = CB.Controls.Add(msoControlButton, 2188, , , True)
CBB.Caption = "Send E-mail..."
CBB.Tag = "Send E-mail..."
CBB.OnAction = "=EmailAsPDF()" 'Calls a module
'Adds the Save As .PDF command.
Set CBB = CB.Controls.Add(msoControlButton, 12499, , , True)
CBB.Caption = "Save As PDF..."
'Adds the Close command.
Set CBB = CB.Controls.Add(msoControlButton, 923, , , True)
'Starts a new group.
CBB.BeginGroup = True
'Change the caption displayed for the control.
CBB.Caption = "Close Report"
CBB.OnAction = "CloseAllReports" 'Calls a module
Set CB = Nothing
Set CBB = Nothing
End Sub