Importing Excel with "&" in worksheet tab

G

Guest

I'm having trouble importing a excel spreadsheet with my VBA code. I'm
currently importing a file that has several worksheet tabs on the bottom of
the spreadsheet. I'm extracting data from a specific tab called
"SigOpt&SigInd_Data". When I write the code to extrac the data, I place the
range, but keep getting an error because of the "&" sign. How would I write
the code for this, to extract that tab with the "&" in the name. Currently my
code looks like this.....

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "Inventory_B",
"C:\Data\Access\32305UCLSOR_PM", True, "SigOpt&SigInd_Data!"
 
D

Douglas J. Steele

Not sure, but see whether using two ampersands in a row works.

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97,
"Inventory_B",
"C:\Data\Access\32305UCLSOR_PM", True, "SigOpt&&SigInd_Data!"
 
G

Guest

Thanks Douglas...this didn't work either though.

Douglas J. Steele said:
Not sure, but see whether using two ampersands in a row works.

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97,
"Inventory_B",
"C:\Data\Access\32305UCLSOR_PM", True, "SigOpt&&SigInd_Data!"
 
D

Dirk Goldgar

MCyn said:
Thanks Douglas...this didn't work either though.

What exact error are you getting, and what version of Access are you
using? I've tried this with Access 2002, and I'm not having any trouble
importing a worksheet with an ampersand in the name. I take it that
"SigOpt&SigInd_Data" really is the name of the worksheet, and not a
named range -- I didn't test the latter.
 

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