Results 1 to 3 of 3

Thread: change the directory of the of a list of arrays file

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    4

    change the directory of the of a list of arrays file

    Hi,
    i wanted to change the directory of the of a list of arrays file..
    But i am having problem when i wrote the code as shown below.. Its part of what i have wrote..
    When i tried to run.. there is a compile error.("CopyFile" was highlighted) Its says " Compile error: Expected Function or variable" I am still very new to VB so does not know what is the problem.. Anyone plz help me ??


    VB Code:
    1. If InStr(file.Name, "24_Hours") > 0 Then
    2.             outputFiles_s(SummarySize) = Replace(inputFiles_s(SummarySize), ".txt", ".doc")
    3.             outputFiles_s(SummarySize) = Replace(outputFiles_s(SummarySize), "_MMM_", thisMonth)
    4.             outputFiles_s(SummarySize) = fso.CopyFile(C:\Sp\mmmyyyy\Source", "C:\Sp\mmmyyyy\Report\24hrs\Summary", True)
    5.             ElseIf InStr(file.Name, "Mon-Fri") > 0 Then
    6.             outputFiles_s(SummarySize) = Replace(outputFiles_s(SummarySize), ".txt", ".doc")
    7.             outputFiles_s(SummarySize) = Replace(outputFiles_s(SummarySize), "_MMM_", thisMonth)
    8.             outputFiles_s(SummarySize) = fso.CopyFile("C:\Sp\mmmyyyy\Source", "C:\Sp\mmmyyyy\Report\Mon-Sat\Summary", True)
    9.             End If

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: change the directory of the of a list of arrays file

    does fso.copyfile actually return anything? If not then you do no need to assign it to the array
    Code:
    fso.CopyFile "C:\Sp\mmmyyyy\Source", "C:\Sp\mmmyyyy\Report\Mon-Sat\Summary", True
    Also, just looking at that above code, would you not need to specify what file you want to copy and the name of the destination to copy to???

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    4

    Re: change the directory of the of a list of arrays file

    Hi Ecniv,

    The fso.copyfile doesn't return anything.. In fact i cant compile the code due to it ! Well i have tried the following and it works..

    outputFiles_s(SummarySize) = "C:\Sp\mmmyyyy\Report\24hrs\Summary" & File.Name
    Where File.Name contains the files in the outputFiles_s(SummarySize)

Posting Permissions

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



Click Here to Expand Forum to Full Width