I had some code that exported a query to an excel file (.xls). I attempted to update the code to export the data into a 2007 Excel file (.xlsx) and everything thing seemed to work up until I try to open the file. I keep getting this message that says that the file cannot be open because the file extension or something in not correct. I checked it 50 times I didnt see anything wrong with the file name. The file is being export to a sharepoint site although I am using the full directory path in my file name. I have included a screenshot of the error along with the code that I am running.
Any assistance with this would be much appreciated.
Public Function ExportFormData()
On Error GoTo ErrorHandler
Dim strDashboardPath As String
Dim strQryEmployees As String
strDashboardPath = "\\teamspace\DavWWWRoot\sites\CCCoaching\"
strQryEmployees = strDashboardPath & "QRY_EMPLOYEES_UUS.xlsx"
DoCmd.TransferSpreadsheet TransferType:=acExport, SpreadsheetType:=acSpreadsheetTypeExcel12, TableName:="QRY_EMPLOYEES", Filename:=strQryEmployees, HasFieldNames:=True
MsgBox "Error No: " & Err.Number _
& ";Description: " & Err.Description