Can anybody assist me with this? The file outputs OK to the location I want however I keep getting an Script Out of range error when Access tries to open the file to run the rest.
DoCmd.OutputTo acOutputQuery, "qryExcel_Selected_List", acFormatXLS, "C:\Users\" & Environ("UserName") & "\Desktop\Selection_List.xls"
Dim xlApp As Object, xlWrkb As Object
Set xlApp = CreateObject("Excel.Application")
Set xlWrkb = xlApp.Workbooks.Open("C:\Users\" & Environ("UserName") & "\Desktop\Selection_List.xls")
xlApp.Sheets("qryExcel_Selected_List").Select
xlApp.Sheets("qryExcel_Selected_List").Name = "Selection_List"
xlApp.Sheets.Add After:=Sheets(Sheets.Selection_List)
xlApp.ActiveCell.FormulaR1C1 = "Selection_Summary"
DoCmd.OutputTo acOutputQuery, "qryExcel_Selected_List", acFormatXLS, "C:\Users\" & Environ("UserName") & "\Desktop\Selection_List.xls"
Dim xlApp As Object, xlWrkb As Object
Set xlApp = CreateObject("Excel.Application")
Set xlWrkb = xlApp.Workbooks.Open("C:\Users\" & Environ("UserName") & "\Desktop\Selection_List.xls")
xlApp.Sheets("qryExcel_Selected_List").Select
xlApp.Sheets("qryExcel_Selected_List").Name = "Selection_List"
xlApp.Sheets.Add After:=Sheets(Sheets.Selection_List)
xlApp.ActiveCell.FormulaR1C1 = "Selection_Summary"