• VB Scripting and FSO.CopyFile

    Author
    Topic
    #461646

    Hello
    I’m working on a script that has these two lines:

    Set ObjFSO=CreateObject(“Scripting.FileSystemObject”)
    objFSO.CopyFile “C:medquote12345.xls”, “C:meddropTest.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 –

    Viewing 0 reply threads
    Author
    Replies
    • #1172056

      Assuming that the QuoteNumber variable will contain a number such as 12345, you should be able to use

      objFSO.CopyFile “C:medquote” & QuoteNumber & “.xls”, “C:meddropTest.xls

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

      objFSO.CopyFile “C:medquote” & QuoteNumber, “C:meddropTest.xls

      • #1172070

        Hans,
        You are the man ! Works perfectly ! The one combination of quotes & & that I didn’t try….haha.

        Thank you SIR !
        – BOB –

        Assuming that the QuoteNumber variable will contain a number such as 12345, you should be able to use

        objFSO.CopyFile “C:medquote” & QuoteNumber & “.xls”, “C:meddropTest.xls

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

        objFSO.CopyFile “C:medquote” & QuoteNumber, “C:meddropTest.xls

    Viewing 0 reply threads
    Reply To: VB Scripting and FSO.CopyFile

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: