Hi all,
I need a VBA code that copies a list of PDF files found in C:\Users\Ron\Data to C:\Users\Ron\Test. The list of PDF filenames to be copied can be found in Range A1:A100 of sheet1.
I found below code when searching the net. I think it is close to what I need with little tweaking...
Thanks
I need a VBA code that copies a list of PDF files found in C:\Users\Ron\Data to C:\Users\Ron\Test. The list of PDF filenames to be copied can be found in Range A1:A100 of sheet1.
I found below code when searching the net. I think it is close to what I need with little tweaking...
Code:
Sub Copy_Certain_Files_In_Folder()
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
FromPath = "C:\Users\Ron\Data"
ToPath = "C:\Users\Ron\Test"
FileExt = "*.xl*"
If Right(FromPath, 1) <> "\" Then
FromPath = FromPath & "\"
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
If FSO.FolderExists(ToPath) = False Then
MsgBox ToPath & " doesn't exist"
Exit Sub
End If
FSO.CopyFile Source:=FromPath & FileExt, Destination:=ToPath
MsgBox "You can find the files from " & FromPath & " in " & ToPath
End Sub
Thanks