Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Sep 2006
    Location
    Illinois, USA
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello
    I'm working on a script that has these two lines:

    Set ObjFSO=CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile "C:\med\quote\12345.xls", "C:\med\drop\Test.xls

    What I'm having trouble with is in the Source section of the CopyFile statement. The actual file name will be coming from a variable named QuoteNumber. I keep getting a File not Found" error message when running the script. I can't seem to get the correct syntax to use the variable name as the Source path. If I keep the path for the Source as stated above, the script runs just fine. There will be a different source file though everytime the script is run.
    Thank you for any suggestions anyone can supply.
    - BOB -

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Assuming that the QuoteNumber variable will contain a number such as 12345, you should be able to use

    objFSO.CopyFile "C:\med\quote\" & QuoteNumber & ".xls", "C:\med\drop\Test.xls

    If QuoteNumber also contains the extension .xls, for example 12345.xls, the line would become

    objFSO.CopyFile "C:\med\quote\" & QuoteNumber, "C:\med\drop\Test.xls

  3. #3
    New Lounger
    Join Date
    Sep 2006
    Location
    Illinois, USA
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans,
    You are the man ! Works perfectly ! The one combination of quotes & & that I didn't try....haha.

    Thank you SIR !
    - BOB -


    [quote name='HansV' post='787358' date='03-Aug-2009 19:33']Assuming that the QuoteNumber variable will contain a number such as 12345, you should be able to use

    objFSO.CopyFile "C:\med\quote\" & QuoteNumber & ".xls", "C:\med\drop\Test.xls

    If QuoteNumber also contains the extension .xls, for example 12345.xls, the line would become

    objFSO.CopyFile "C:\med\quote\" & QuoteNumber, "C:\med\drop\Test.xls[/quote]

Posting Permissions

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