Function findimage(Path As String, ImageList As String)
Dim results
Dim x As Long
Dim dc 'double comma
Dim extension As String
results = Split(ImageList, ",")
If Not Right(Path, 1) = "\" Then Path = Path & "\"
For x = 0 To UBound(results)
If Len(Dir(Path & results(x))) > 0 Then
results(x) = True
Else
extension = Right(results(x), Len(results(x)) - InStrRev(results(x), "."))
results(x) = "False(" & getFileCount(Path, "*." & extension) & ")"
End If
Next
dc = InStr(ImageList, ",,")
If dc = 0 Then
findimage = Join(results, ",")
Else
findimage = ("Double_comma")
End If
End Function
Function getFileCount(DirPath As String, ParamArray Patterns() As Variant) As Integer
Dim MyFile As String
Dim count As Integer, x As Long
If Not Right(DirPath, 1) = "\" Then DirPath = DirPath & "\"
MyFile = Dir(DirPath, vbDirectory)
Do While MyFile <> ""
For x = 0 To UBound(Patterns)
If MyFile Like Patterns(x) Then
count = count + 1
Exit For
End If
Next
MyFile = Dir()
Loop
getFileCount = count
End Function
solved merging two vba functions