470,630 Members | 1,953 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,630 developers. It's quick & easy.

Importing Excel into Access

I am having difficulting importing an Excel spreadsheet into my Access
program using VBA
I want to use the last argument to specify the worksheet name which is RTA.
I get an error which
says that the name worksheet or path is incorrect. However, if I "rem" out
the last parameter and make RTA
the 1st sheet in the Excel workbook, everything is imported correctly.
Unfortunately, I have several
worksheets in the workbook which need to be imported and thus the last
parameter is crucial.

DoCmd.TransferSpreadsheet acImport, , "RTAccess", "C:\ProminentPlacement\ASL
Report July 04.xls", True, "RTA"
Nov 13 '05 #1
2 2491
I'm just guessing here but have you tried writing the import as follows:

DoCmd.TransferSpreadsheet acImport, , "RTAccess", "C:\ProminentPlacement\ASL
Report July 04.xls!RTA", True

It might work if you can specify the worksheet in the file path rather than
as an extra parameter at the end.

"Bill Agee" <ws**@mindspring.com> wrote in message
news:ng*****************@newsread3.news.atl.earthl ink.net...
I am having difficulting importing an Excel spreadsheet into my Access
program using VBA
I want to use the last argument to specify the worksheet name which is RTA. I get an error which
says that the name worksheet or path is incorrect. However, if I "rem" out the last parameter and make RTA
the 1st sheet in the Excel workbook, everything is imported correctly.
Unfortunately, I have several
worksheets in the workbook which need to be imported and thus the last
parameter is crucial.

DoCmd.TransferSpreadsheet acImport, , "RTAccess", "C:\ProminentPlacement\ASL Report July 04.xls", True, "RTA"

Nov 13 '05 #2
Bill,

Give the worksheet a Range Name of RTA and then use your code as is with
"RTA" at the end.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Bill Agee" <ws**@mindspring.com> wrote in message
news:ng*****************@newsread3.news.atl.earthl ink.net...
I am having difficulting importing an Excel spreadsheet into my Access
program using VBA
I want to use the last argument to specify the worksheet name which is RTA. I get an error which
says that the name worksheet or path is incorrect. However, if I "rem" out the last parameter and make RTA
the 1st sheet in the Excel workbook, everything is imported correctly.
Unfortunately, I have several
worksheets in the workbook which need to be imported and thus the last
parameter is crucial.

DoCmd.TransferSpreadsheet acImport, , "RTAccess", "C:\ProminentPlacement\ASL Report July 04.xls", True, "RTA"

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Grim Reaper | last post: by
7 posts views Thread by Darren | last post: by
9 posts views Thread by jillandgordon | last post: by
5 posts views Thread by hharriel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.