Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import one particular sheet of an excel file to spreadsheet?

Status
Not open for further replies.

tekvb1977

Technical User
Nov 16, 2005
46
US
I have an excel file that has two tabs: i.e. two worksheets A and B.

I only want to import worksheet B into excel table. How could I do that. I tried using the following command but it tries to import both sheets into the access table.

DoCmd.TransferSpreadsheet acImport, , "AppendQuotes", "G:\QuoteSheets\" & strFolderName, True


Any ideas/thoughts will be highly appreciated.

Thanks,

J
 
tekvb1977,
[tt]DoCmd.TransferSpreadsheet acImport, , "AppendQuotes", "G:\QuoteSheets\" & strFolderName, True, "Worksheet B"[/tt] ?

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
I had to do some looking on this... I needed columns A-F on my worksheet so I ended up with something like...

DoCmd.TransferSpreadsheet acImport, , "AppendQuotes", "G:\QuoteSheets\" & strFolderName, True, "Worksheet B!A:F"

Catch here is that it takes a range, so you have to specify some sort of range.
 
You can simply use a range of "Worksheet B!" without the reference to columns and rows. The ! (exclamation point) is the key part you were missing.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top