Hello, I have this code below that searches our server for existing PDF files and reports back in a column Yes or no. It works fine, but not for all subfolders. Can this be modified instead of searching just X:\PDF Drawings\55-TILL PDF
Can it be this folder X:\PDF Drawings\ and all 15 subfolders?
Can it be this folder X:\PDF Drawings\ and all 15 subfolders?
Sub CheckIfFileExists() Dim LRow As Integer Dim LPath As String Dim LExtension As String Dim LContinue As Boolean 'Initialize variables LContinue = True LRow = 2 LPath = "X:\PDF Drawings\55-TILL PDF" LExtension = ".pdf" 'Loop through all column A values until a blank cell is found While LContinue 'Found a blank cell, do not continue If Len(Range("A" & CStr(LRow)).Value) = 0 Then LContinue = False 'Check if file exists for part number Else 'Place "No" in column E if the file does NOT exist If Len(Dir(LPath & Range("A" & CStr(LRow)).Value & LExtension)) = 0 Then Range("D" & CStr(LRow)).Value = "No" 'Place "Yes" in column D if the file does exist Else Range("D" & CStr(LRow)).Value = "Yes" Range("D1") = "Assy Drawing Finished Yes/No" End If End If LRow = LRow + 1 Wend End Sub
Last edited by a moderator: