TransferSpreadSheet Export to "here"

E

eclusion

When using the TransferSpreadSheet Macro, is there any way to replace the
File Name with one that will default to the place the Access Database resides?
I do not want to change the path every time or retrieve the file from a hard
coded location.

Mark
 
P

PieterLinden via AccessMonster.com

eclusion said:
When using the TransferSpreadSheet Macro, is there any way to replace the
File Name with one that will default to the place the Access Database resides?
I do not want to change the path every time or retrieve the file from a hard
coded location.

Mark

By using macros, no. Not flexible enough. IF you convert the macro to VBA
then you can add variables and fun things like that... You could use the
OpenSaveFile API to prompt the user for a filename/directory.... use
CurrentProject.Path to get the database's directory.
 
S

Steve Schapel

Mark,

I am not 100% clear of your meaning. You mean you are importing data from
an Excel file, and it will be in the same loacation as the Access file? If
so, then set the File Name argument of the TransferSpreadsheet action in
your macro to the equivalent of:
=[CurrentProject].[Path] & "\YourFile.xls"
 
K

Ken Snell

Actually, yes.

Use an expression as the File Name argument for the macro action:

=CurrentProject.Path & "\YourDesiredFileNameHere.xls"
 
S

Steve Schapel

Nice to see you, Ken! :)

--
Steve Schapel, Microsoft Access MVP


Ken Snell said:
Actually, yes.

Use an expression as the File Name argument for the macro action:

=CurrentProject.Path & "\YourDesiredFileNameHere.xls"
 
E

eclusion via AccessMonster.com

Thank you Ken! That worked perfectly.
Mark

Steve said:
Mark,

I am not 100% clear of your meaning. You mean you are importing data from
an Excel file, and it will be in the same loacation as the Access file? If
so, then set the File Name argument of the TransferSpreadsheet action in
your macro to the equivalent of:
=[CurrentProject].[Path] & "\YourFile.xls"
When using the TransferSpreadSheet Macro, is there any way to replace the
File Name with one that will default to the place the Access Database
[quoted text clipped - 4 lines]
 

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