I was trying to export A report from Access to Excel using the code below.
pat = CurrentProject.Path
Set xlo = CreateObject("Excel.Application")
Nname = "MonthlyData" & Left(Now(), 5)
DoCmd.OutputTo acOutputReport, "MonthlyAll", "Excel 97 - Excel 2003 Workbook (*.xls)", pat & "\" & Nname & ".xls", True
It works fine in my system but isn't working on any other I have tried since. I am not able to export to any other excel formats in my system as well. I have the following references selected in my system,
Visual Basics for Applications Microsoft Access 15.0 object Library OLE Automation Microsoft Office 15.0 Access database engine object Library Microsoft Excel 15.0 object Library Microsoft Office 15.0 object Library
I haven't checked for these references yet. Not sure if that is the reason. I am using windows 10 which is not the problem. I have checked for compatibility.