Link to home
Start Free TrialLog in
Avatar of j e
j e

asked on

Access - transferspreadsheet

I'm trying to import two different worksheets from an Excel file.  When I set the 'range' = to the worksheet that I want, it still brings in the first worksheet.

1st worksheet name = "Functions"
3rd worksheet name = "Role"

The frmTab variable is set to the worksheet name.

Here is the code:                DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, frmTab, GetFile, True, frm_Tab

???

Thanks for your help,
Jeanne
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image


 It will only do the first tab.   Range is a range of cells on that first tab or a named range in the spreadsheet.


 If you have more than one sheet, you'd need to use VBA code and automation.


Jim.

ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of j e
j e

ASKER

Thanks -- I had that but just had the "!" in the wrong place and misspelled the sheetname variable.
je