Hi experts,
I have a problem about move files from folder to another based certain prefix
the code doesn't work for me, but when I create folder to become into source folder "C:\Users\PC-AL\Downloads\DATA\" then the code moves the files from folder to another . why this case does for me ?
Sub MoveFiles()
Dim DestinationFolder As String
Dim FileExtention As String
Dim SourceFile As String
Dim SourceFolder As String
On Error Resume Next
SourceFolder = "C:\Users\PC-AL\Downloads\"
DestinationFolder = "C:\Users\PC-AL\Downloads\rr\"
FileExtention = "pdf"
If Dir(DestinationFolder, vbDirectory) = 0 Then MkDir DestinationFolder
SourceFile = Dir(SourceFolder & "*." & FileExtention)
Do While SourceFile Like "PR*"
Name (SourceFolder & SourceFile) As (DestinationFolder & SourceFile)
SourceFile = Dir
Loop
End Sub