Been a very long time since I tried to do this. Every time I try to open the exported workbook, it is corrupted. Are the spreadsheet types changed in Office 365?
Alan
Code:
Private Sub cmdMailPrinter_Click()
On Error GoTo cmdMailPrinter_Click_Err
' DoCmd.OpenQuery "qryMailing4Printer", acViewNormal, acEdit
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryMailing4Printer", _
"C:\USERS\" & Environ("USERNAME") & "\Desktop\Printer_" & _
Format(Now(), "yyyymmdd") & ".xlsx", True
cmdMailPrinter_Click_Exit:
MsgBox "File at C:\USERS\" & Environ("USERNAME") & "\Desktop\Printer_" & _
Format(Now(), "yyyymmdd")
Exit Sub
cmdMailPrinter_Click_Err:
MsgBox Error$
Resume cmdMailPrinter_Click_Exit
End Sub
Alan