Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2015
    Posts
    2

    Unanswered: TransferSpreadsheet problem

    Any help appreciated. Driving me nuts. Following code works perfectly:

    DoCmd.TransferSpreadsheet acImport, 10, "Translator", "C:\Documents and Settings\user\My Documents\Translator.xlsx", True, ""

    however when changed to:

    mypath = CurrentProject.Path
    myfile = mypath & "\ Translator.xlsx"
    DoCmd.TransferSpreadsheet acImport, 10, "Translator", myfile, True, ""

    I get an error message saying the file cannot be found. The variable myfile shows in the watch window or in a Msgbox as letter by letter identical to the original path and filename.

    What is going on??

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is the space in
    Code:
    myfile = mypath & "\ Translator.xlsx"
    part of your code or a typo when you posted the code here?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2015
    Posts
    2

    Red face Kick me, I'm stupid

    Have I really been looking at this for hours and not seen that? Many thanks and I look forward to asking the odd serious question occasionally
    David

  4. #4
    Join Date
    Jan 2012
    Location
    India
    Posts
    42
    Try this:

    myfile = mypath & "\" & "Translator.xlsx"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •