1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub cmb_Excel_Click()
Beep
Reponse = MsgBox("Souhaitez-vous exporter les dossiers affichés ?", vbYesNo, "Test")
If Reponse = vbYes Then
stDocName = "rpt_tbl_All"
On Error Resume Next
If Me.frm_tbl_All.Form.FilterOn = False Then
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.OutputTo acReport, stDocName, "(*.xls)", "C:\Test\test_export.xls", False, ""
DoCmd.Close acReport, stDocName, acSaveNo
Else
DoCmd.OpenReport stDocName, acViewPreview, , Me.frm_tbl_All.Form.Filter
'DoCmd.OutputTo acOutputReport, stDocName, acSpreadsheetTypeExcel14, XFile, False ' Cette ligne me donne la possibilité de choisir le format mais sans xlsb ou xlsx
DoCmd.OutputTo acReport, stDocName, "(*.xls)", "C:\Test\test_export.xls", False, ""
DoCmd.Close acReport, stDocName, acSaveNo
End If
On Error GoTo 0
End If |
Partager