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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks -- I had that but just had the "!" in the wrong place and misspelled the sheetname variable.
je
je
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.