Hi
I have the following code to search and list certain file in folder, however, it picks the old one!
I need the vba to pick the most recent file.
I have the following code to search and list certain file in folder, however, it picks the old one!
I need the vba to pick the most recent file.
VBA Code:
Sub OH()
Dim i As Integer
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To FinalRow
Dim files As Collection
Set files = ListFiles(Cells(i, 67), Cells(i, 1) & "*.pdf")
Dim fileName As Variant
Dim AdobeCommand As String
Const cAdobeReaderExe As String = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
For Each fileName In files
Cells(i, 68) = Cells(i, 67) & fileName
Next
Next
End Sub