我目前正在使用 Microsoft Access 2010。有没有办法消除“另存为”对话框?运行它显示的命令后,然后当您单击取消时,它会将报告打印到正确的位置。这是每次都会显示的细微差别。
Public Sub PrintReportToPDF(ByRef strReport As String, ByRef FilePathandFileName As String)
On Error GoTo ErrHandler
DoCmd.SetWarnings False
DoCmd.OpenReport strReport, acViewNormal
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF,
FilePathandFileName & ".pdf", False, "", 0, acExportQualityPrint
ExitHere:
DoCmd.SetWarnings True
Exit Function
ErrHandler:
MsgBox Err.Description
Resume ExitHere
End Sub