Import specific columns from Excel

R

Rafi

I need to import specific columns (A through G) from Excel; however, the
input files (excel) Does not have a constant number of columns. I only need
the first 8 columns. The Excel file has a header row and the column names are
known. Alternatively, I can name the 8 columns that need to be imported.

Thanks for your help

I have tried the following VBA code which resulted in an error: Run-Time
error 3170 - Could Not find Installable ISAM however, to the best of my
knowledge, the reference is in the registry.

Function DHL_Import()
Dim db As DAO.Database
Dim stSQL As String
stSQL = "Insert Into TblRecords" _
& " Select F1 as Name, F2 as [Address 1], F3 as [Address 2], f4 as City," _
& " F5 as State, F6 as [Postal Code], F7 as [Postal Code Plus Four], F8 as
Account" _
& " From [XLS;HDR=Yes;Database=C:\Test\].myImport.xls"
Set db = CurrentDb()
CurrentDb.Execute stSQL

End Function
 
J

Jeff Boyce

Rafi

Rather than importing, is there a way you could use a query against a linked
table?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top