TransferSpreadSheet Export to "here"

Discussion in 'Access Macros' started by eclusion, May 28, 2010.

  1. eclusion

    eclusion Guest

    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
     
    eclusion, May 28, 2010
    #1
    1. Advertisements

  2. 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.
     
    PieterLinden via AccessMonster.com, May 29, 2010
    #2
    1. Advertisements

  3. 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"
     
    Steve Schapel, May 29, 2010
    #3
  4. eclusion

    Ken Snell Guest

    Actually, yes.

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

    =CurrentProject.Path & "\YourDesiredFileNameHere.xls"
     
    Ken Snell, May 30, 2010
    #4
  5. Nice to see you, Ken! :)

    --
    Steve Schapel, Microsoft Access MVP


     
    Steve Schapel, May 30, 2010
    #5
  6. eclusion

    Ken Snell Guest

    Ken Snell, May 31, 2010
    #6
  7. Thank you Ken! That worked perfectly.
    Mark

     
    eclusion via AccessMonster.com, Jun 1, 2010
    #7
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.