1 2 3 4 5 6 7 8 9 10 11 12 13
| Public Sub ExportMyReport(ByVal ReportName As String, ByVal XLSFilename As String, ByVal OpenAfter As Boolean)
Const MSG_ERR As String = "Assurez-vous que le fichier n'est pas en cours d'utilisation..."
Const ERR_INUSE As Long = 2302
On Error GoTo L_ErrExportMyReport
DoCmd.OutputTo acOutputReport, ReportName, acOutputReport, XLSFilename, OpenAfter
On Error GoTo 0
L_ExExportMyReport:
Exit Sub
L_ErrExportMyReport:
MsgBox Err.Description & IIf(Err = ERR_INUSE, vbCrLf & vbCrLf & MSG_ERR, ""), 48, "Export vers Excel"
Resume L_ExExportMyReport
End Sub |
Partager