Importing .XLS files

Soma_rich

Registered User.
Local time
Today, 10:12
Joined
May 2, 2007
Messages
58
I had a look at the search results and I couldnt see what I needed. I want to import spreadsheets and create the tables using the files names of the XLS. This is what I have so far anyone able to help?

Private Sub Command0_Click()

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, StrFileName, "C:\Temp\CI\*.xls", True

End Sub
 
Why don't you just link to the file???
 
because I am import 60+ files with differant file names and the 60 will change each month.
 
Private Sub Command0_Click()

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, StrFileName, "C:\Temp\CI\*.xls", True

End Sub

Okay, comments about this:

1. acSpreadsheetTypeExcel97 (doesn't exist as an option for me) acSpreadsheetTypeExcel8 would be the choice if you are using 97.
2. As mentioned by llkhoutx, StrFileName doesn't seem to have a value and that should be the table name that you are importing to.
3. "C:\Temp\CI\*.xls" is not a valid file path. You have to tell it what file you are importing, you can't use an asterisk. You could do something like: "C:\Temp\CI\" & strFile & ".xls" if you assigned a value to strFile.
 

Users who are viewing this thread

Back
Top Bottom