Access VBA - Import Spreadsheet
Posted on 2007-10-15
Can someone tell me how to simply insert a spreadsheet into an access table using VBA. I am using the code attached but it wants a specific column avilable for each row in the spreadsheet. My spreadsheet simply has one row ( at the moment ) with a series of numbers in it. But when I import to my access table it gives me an error cant find column F1 in table. Why F1? If I change my column to F1 it works. Is there anyway to insert the data in column 1 of the spreadsheet into column 1 of my table and so on.
Dim strTargetTable As String
strTargetTable = "tbl_test"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTargetTable, Me.txtFilePath.Value, False