Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 894
  • Last Modified:

How to use DoCmd.TransferText to import a worksheet

Hi,

i'm working in an access database and I want to import some data into a new table.
I'm using following code:
     DoCmd.TransferText acImportDelim, "", "TMP_TABLE", "c:\my_file.xls", True

But I need to import only the second sheet of my xls file.
How can I do this using the above line of code?
0
y_wally
Asked:
y_wally
1 Solution
 
cquinnCommented:
docmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TMP_TABLE", "c:\my_file.xls", true, "WorksheetName"

Change the True to False if the first row does not contain column headings
0
 
y_wallyAuthor Commented:
docmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TMP_TABLE", "c:\my_file.xls!SheetName", true, "WorksheetName!A:Z"

whereby A:Z is the range of columns you need to import.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now