I am getting an error while importing an .xlsx file using the code below. I have used this code without issue in the past for other tables. I made sure to copy the path from file manager to be sure I had it correct.
Interestingly, a user was getting this error for a different file last month, with code that had never been an issue. I could not find anything wrong and it imported on other computers without issue. Not sure what is going on. I've also attached the file I'm trying to import just in case there is anything wrong with the file. What am I missing?
Thanks,
Alicia
Code: Select all
Dim strFolder As String
Dim strFile As String
' Fixed folder path
strFolder = "C:\Walmart\Import-CDS\VDC-RentAndRoyaltySales"
' Find filename
strFile = Dir(strFolder & "*.xlsx")
If strFile = "" Then
MsgBox "No .xlsx file in folder!", vbExclamation
Exit Sub
End If
' Import VDC spreadsheet
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, _
"tblImportTemp-VDCRentRoyaltySales", strFolder & strFile, True