So I have a loop that's supposed to do three things, go through a text file line by line, the text file contains pathnames and filenames(C:\Folder\file1.txt) If the line contains a certain string, it then copies a file to that location, renames it to what it is named in the text file, and then replaces a string within the copied file(still with me?). If not it goes on to the next line. I thought this would be fairly straight forward but I doesn't seem to be working, I'm currently unable to even compile as I'm getting errors saying the loop's syntax is wrong. Any help would be appreciated, here's the entire function's code:
Private Sub Command2_Click()
Dim LineData As String
Dim FileHandle As Integer
FileHandle = FreeFile
Open "C:\textfile.txt" For Input As #FileHandle
Do While Not EOF(FileHandle)
Line Input #FileHandle, LineData
If InStr(LineData, ".log") Then
FileCopy "C:\thefile.log",LineData
Open LineData For Input As #3
#3 = Replace$(#3, "abc", "xyz")
Else
End If
Loop
Close #FileHandle
Close #3
MsgBox "Copy, Replace, Complete!"
End Sub
Thanks in Advance!