I am trying to read a table in access2013 and export it to a spreadsheet in excel2013. I am actually naming the spreadsheet using a value in one of the tables fields. It works well except when I try to open the spreadsheet it gives me the error: "excel cannot open the file 'Weekly_timesheet_summary_20160730.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file format matches the format of the file". Belo0w is my code:
In the line
I also used acspreadsheettype12 to no avail.
Cretin
Code:
Dim strfilename As String
Dim db As Database
Set db = CurrentDb()
Dim strDate As DAO.Recordset
Dim LSQL As String
Dim LGST As String
Dim strpath As String
LSQL = "select Date from Time_Summary"
Set strDate = db.OpenRecordset(LSQL)
strpath = "U:\Projects\time tracker\testing\"
If strDate.EOF = False Then
LGST = strDate("Date")
Else
LGST = "Not Found"
End If
strfilename = strpath & "Weekly_timesheet_summary_" & Format(LGST, "yyyymmdd") & ".xlsx"
DoCmd.TransferSpreadsheet acExport, 10, "Time_Summary", strfilename, True
strDate.Close
Set strDate = Nothing
GetGST = LGST
In the line
Code:
DoCmd.TransferSpreadsheet acExport, 10, "Time_Summary", strfilename, True
Cretin