It will work with files of any type e.g.:
Dim strFile As String
strFile = Dir("C:\SomeFolder\*.pdf")
'check if any pdfs found:
If Len(strFile)>0 Then
'return to a cell:
Cells(Rows.Count,"A").End(xlUp).Offset(1).Value = strFile
'now set up a loop to get all pdfs:
Do
strFile = Dir 'note, no need to include anything else here - same criteria as before will be used
If Len(strFile)>0 Then Cells(Rows.Count,"A").End(xlUp).Offset(1).Value = strFile
Loop While Len(strFile) > 0
Else
MsgBox "No pdf found!"
End If
Bookmarks