Turn off Shortcut Menu on Reports (1 Viewer)

basilyos

Registered User.
Local time
Today, 08:33
Joined
Jan 13, 2014
Messages
252
sorry but you cant put any FaceID on the macro.
you have to use VBA and create the menu there.
paste in Module:
Code:
Sub CreateContextMenu()
    Const strMenuName As String = "ContextMenu1"
    On Error Resume Next
    Dim cbar As CommandBar
    Dim bt As CommandBarButton
    'delete first if already exists
    CommandBars.Item(strMenuName).Delete
    'recreate
    Set cbar = CommandBars.Add(strMenuName, msoBarPopup, , False)
    Set bt = cbar.Controls.Add
    With bt
        .Caption = "&Print"
        .OnAction = "=fnPrint()"
        .FaceId = 15948
    End With
End Sub
run this and this "ContextMenu1" will be available
on your form/report Property->Other->Shortcut Menu Bar

hello am trying to use your module but am getting an error
Invalid procedure call or argument
on this line => CommandBars.Item(strMenuName).Delete

any solution ?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:33
Joined
May 7, 2009
Messages
19,227
What version do you have? Have you made reference to Microsoft Office xx. X Object on VBE?
 

Abo Abd_Allah

New member
Local time
Today, 18:33
Joined
Sep 23, 2016
Messages
16
i'm try ues this code for export report to excel
but i don't know how passing report name to function parmeter
Code:
    Dim cmbRightClick As Office.CommandBar
    Dim cmbControl As Office.CommandBarControl
On Error Resume Next
       ' Create the shortcut menu.
    Set cmbRightClick = Application.CommandBars.Add("MyRepRightClkMenu", msoBarPopup, False, True)
   With cmbRightClick   
      cmbControl.BeginGroup = True
       set  cmbControl=.Controls.Add
        With cmbControl
        .Caption = "Export to Excel"
        .FaceId = 11723
        .OnAction = "=ExportExcelSb(me.name)"
        End With
   End With
'this Export to excel sub
'======================
Public Sub ExportExcelSb(ByVal repname As String)
Dim savPas As String
savPas = calFilDilog(2, "Expor To Excel")
DoCmd.OutputTo acOutputReport, repname, "Excel97-Excel2003Workbook(*.xls)", savPas, True, "", , acExportQualityPrint
End Sub
thanks
 

Users who are viewing this thread

Top Bottom