Sub CheckIfFileExists()
Dim LRow As Integer
Dim LPath As String
Dim LExtension As String
Dim LContinue As Boolean
Dim MPath As Integer
Dim FNAme As String
Dim sourceFile As String
Dim targetFile As String
Dim fso As Object
LContinue = True
LRow = 2
MPath = 2
LPath = “C:New Folder”
LExtension = “.pdf”
While LContinue
If Len(Range(“A” & CStr(LRow)).Value) = 0 Then
LContinue = False
Else
aa = “C:New Folder”
Set fso = CreateObject(“Scripting.FileSystemObject”)
bb = “C:New Folder”
Set fs = CreateObject(“Scripting.FileSystemObject”)
bb = bb & “” & Range(“A” & CStr(MPath)).Value
bb = bb & “.PDF”
If fs.FileExists(bb) = True Then
Range(“B” & CStr(LRow)).Value = “Yes”
FNAme = Range(“C” & CStr(MPath)).Value
aa = aa & “” & FNAme
If fs.FolderExists(aa) = False Then
fs.createfolder aa
End If
aa = aa & “”
fso.MoveFile bb, aa
End If
End If
Set fs = Nothing
Set fso = Nothing
LRow = LRow + 1
MPath = MPath + 1
Wend
End Sub