DoCmd.TransferSpreadsheet (Access)
The TransferSpreadsheet method carries out the TransferSpreadsheet action in Visual Basic.
You can use the TransferSpreadsheet method to import or export data between the current Access database or Access project (.adp) and a spreadsheet file. You can also link the data in an Excel spreadsheet to the current Access database. With a linked spreadsheet, you can view and edit the spreadsheet data with Access while still allowing complete access to the data from your Excel spreadsheet program. You can also link to data in a Lotus 1-2-3 spreadsheet file, but this data is read-only in Access.
TransferSpreadsheet (TransferType, SpreadsheetType, TableName, FileName, HasFieldNames, Range, UseOA)
DoCmd.TransferSpreadsheet acImport, 3, _
"Employees","C:\Lotus\Newemps.wk3", True, "A1:G12"
Arguments
Optional arguments
The following arguments are optional
TransferType (AcDataTransferType) - The type of transfer that you want to make. The default value is acImport.
Possible return values are acExport - The data is exported, acImport - The data is imported, acLink - The database is linked to the specified data source.
SpreadsheetType (AcSpreadSheetType) - The type of spreadsheet to import from, export to, or link to.
Here you can find possible values for
TableName (String) - A string expression that is the name of the Office Access table that you want to import spreadsheet data into, export spreadsheet data from, or link spreadsheet data to, or the Access select query whose results you want to export to a spreadsheet.
FileName (String) - A string expression that's the file name and path of the spreadsheet that you want to import from, export to, or link to.
HasFieldNames (Boolean) - Use True (1) to use the first row of the spreadsheet as field names when importing or linking. Use False (0) to treat the first row of the spreadsheet as normal data. If you leave this argument blank, the default (False) is assumed. When you export Access table or select query data to a spreadsheet, the field names are inserted into the first row of the spreadsheet no matter what you enter for this argument.
Range (String) - A string expression that's a valid range of cells or the name of a range in the spreadsheet. This argument applies only to importing. Leave this argument blank to import the entire spreadsheet. When you export to a spreadsheet, you must leave this argument blank. If you enter a range, the export will fail.
UseOA - This argument is not supported