I have multiple excel files that have everything on Sheet2 and row "A" with file names such as:
2012-015GHEW-BW-1981-b1_1.0_0001.tif
2012-015GHEW-BW-1982-b1_3.0_0014.tif
2012-015GHEW-BW-1982-b1_7.1_0008.tif
I would like to use these Excel files to move all files listed from folder "C:\Test" to a folder named "C:\Test2", I thought I could do it with one of your VB script's but I get one error
"Run-time error '76'"
Path not found.
the error is on this line of code
This is the full script I'm using:
2012-015GHEW-BW-1981-b1_1.0_0001.tif
2012-015GHEW-BW-1982-b1_3.0_0014.tif
2012-015GHEW-BW-1982-b1_7.1_0008.tif
I would like to use these Excel files to move all files listed from folder "C:\Test" to a folder named "C:\Test2", I thought I could do it with one of your VB script's but I get one error
"Run-time error '76'"
Path not found.
the error is on this line of code
Code:
FileCopy oldFile, newFile
This is the full script I'm using:
Code:
Sub SetUp4a() Dim rng As Range
Dim oldPath As String
Dim newPath As String
Dim oldFile As String
Dim newFile As String
'================================================
'Set the paths to the folders you are processing
'REMEMBER END BACKSLASH
'================================================
oldPath = "C:\Test\"
newPath = "C:\Test2\"
'=======================================================
'set up the start of the range you want to loop through
'EDIT SHEET NAME AND FIRST CELL ADDRESS IF NECESSARY
'======================================================
Set rng = Sheets("Sheet2").Range("A1")
'==================================================
'loop through column B until you find an empty cell
'==================================================
Do Until rng = ""
'build up the full path to the old file
oldFile = oldPath
'build up the full path to the new file you want to create
newFile = newPath
'copy the old file to the new new folder
FileCopy oldFile, newFile
'get the next file by moving down one row
Set rng = rng.Offset(1, 0)
Loop
End Sub