Access more than one type of file with Dir() in Excel VBA?
Please, try the next way:
Dim file as string, folder as string, arrExt
folder = "your folder path"
file = Dir(folder & "\*.*")
Do While file <> ""
arrExt = split(file, ".")
If UCase(arrExt(Ubound(arrExt))) = "JPG" Or _
UCase(arrExt(Ubound(arrExt))) = = "PNG" Then
' do whatever you need
End If
file = Dir
Loop