Log in

View Full Version : import only 2 columns from excel



samuelimtech
07-09-2014, 02:07 AM
Hi all.
This must be soo simple nobody has asked the question before lol
all Im after is a quick code that will import only 2 columns from a spreadsheet. I at the stage below and have tried various combinations but cant get it working.
the code should be sufficient for your to understand what im trying to achieve.


Dim MyFile As String
Dim MyPath As String
MyPath = "T:\Inter Urban\Consultancy Services\Timesheets\Templates\Access\"
MyFile = "HA Systems input master.xlsm"


DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Job-Account", _
MyPath & MyFile, _
True, "Direct Labour codes!A:A" & "Direct Labour codes!F:F"
End Sub


thanks for any help

Bob Phillips
07-09-2014, 04:59 AM
Maybe try


"Direct Labour codes!A:A,Direct Labour codes!F:F"