Code problem on find/copy files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NigelBrown
    New Member
    • Oct 2009
    • 34

    Code problem on find/copy files

    Hi All,

    I am having problems with the below code, it was working but as soon as I included the formatted dates as part of the file path the code now by passes the Dir$ and Ends the Sub - anyone know whats going worng please

    [Code=vb]

    Private Sub Command0_Click( )

    Dim Fdate As String
    Dim Fdate1 As String
    Dim Fdate2 As String
    Dim S As String


    Fdate = Year(Date)
    Fdate1 = Format(Date, "yyyy-mmm")
    Fdate2 = Format(LastWork ingDay, "yyyymmdd")

    S = Dir$("\\path1\p ath2\path3\GEDD Support\Live\Ro nnie2\ "& Fdate "\" & Fdate1 "\" & Fdate2" \*.pny.Prophet9 ")
    Do While Len(S) > 0
    FileCopy "\\path1\path2\ path3\GEDDSuppo rt\Live\Ronnie2 \" & Fdate" \" & Fdate1" \" & Fdate2" \" & S, "\\path4\path5\ path6\Recs and Control\NY_Prop het.txt"
    S = Dir$
    Loop
    End Sub

    [/Code]

    Thanks
    Nigel
  • NigelBrown
    New Member
    • Oct 2009
    • 34

    #2
    Sorry all - I have now fixed this, I combined the dates first as
    test = Fdate & "\" & Fdate1 & "\" & Fdate2 and then called test within the file path.

    Thanks

    Comment

    Working...