thanks Orange for your help
I know to convert Macro to VBA , but How will I call those code in VBA , I mean when change Macro to VBA , because when change it to VBA , it will change to an independence Function code , Like this below code :
Code:
Option Compare DatabaseOption Explicit
'------------------------------------------------------------
' PrintingCommands_Print
'
'------------------------------------------------------------
Function PrintingCommands_Print()
On Error GoTo PrintingCommands_Print_Err
DoCmd.RunCommand acCmdPrint
PrintingCommands_Print_Exit:
Exit Function
PrintingCommands_Print_Err:
MsgBox Error$
Resume PrintingCommands_Print_Exit
End Function
'------------------------------------------------------------
' PrintingCommands_Export_To_Excel
'
'------------------------------------------------------------
Function PrintingCommands_Export_To_Excel()
On Error GoTo PrintingCommands_Export_To_Excel_Err
DoCmd.RunCommand acCmdExportExcel
PrintingCommands_Export_To_Excel_Exit:
Exit Function
PrintingCommands_Export_To_Excel_Err:
MsgBox Error$
Resume PrintingCommands_Export_To_Excel_Exit
End Function
How I will call that code by using right click , when I click by right click in report it gives me both (Print and Export To Excel ....) ?