Good morning. I have a problem when I try to generate an excel from an access table (2010). I have the following code.
Dim outputFileName As String
Dim objExcel As Object 'New Excel.Application
Dim objWB As Object 'Workbook
'Nombre del archivo de salida
outputFileName = CurrentProject.Path & "\Salida\Cartelera_" & Format(Date, "yyyyMMdd") & "_" & Format(Time, "HHmmss") & ".xlsx"
FileCopy CurrentProject.Path & "\PlantillaCartelera.xlsx", outputFileName
Set objExcel = CreateObject("Excel.Application")
Set objWB = objExcel.Workbooks.Open(outputFileName)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "temp", outputFileName, False
objWB.ActiveSheet.Select
'objWB.Worksheets("Datos").Visible = False
'objExcel.Visible = True
Set objExcel = Nothing
When I execute it, the following error message appears
The '3011' error occurred at runtime: The Microsoft Office database engine could not find the 'temp' object. Make sure that the object exists and that you have written the name and path of the object correctly. If 'temp' is not a local object, check the network connection or contact the server administrator.
The route is well defined because if I create the excel file where I want to insert the table "temp" and the table 'temp' if it has records. Can someone help me?