Kaw4Life
Kaw4Life

Reputation: 209

Import Discontiguous Excel Columns to Access

enter image description here

strRange = "C:C,H:H,J:J,S:S,AA:AA"

DoCmd.TransferSpreadsheet , cSpreadsheetTypeExcel12Xml, "tbl_adds", strInputFileName, True, stRange

The spreadsheet in question has 40 columns of which I only need 5 (listed in stRange)

Is this a syntax thing or do I have to use a different method?

Upvotes: 0

Views: 43

Answers (1)

Gustav
Gustav

Reputation: 55841

Don't import but link the worksheet.

Create a simple select query with the linked table as source. In this, mark the five columns in question and save the query.

Now use this query for your import.

Upvotes: 2

Related Questions