Hi Guys
Can anyone please help me.
I am trying to add to the macro below, but i can't seem to find the right method.
I am searching a folder for picture files. My issue however is, that am only able to search for files using a "*" as i do not know the full file name, only a article number.
When the search finds a match, i need the macro to return the full name of the path including whatever the "*" represents
Can anyone please help me.
I am trying to add to the macro below, but i can't seem to find the right method.
I am searching a folder for picture files. My issue however is, that am only able to search for files using a "*" as i do not know the full file name, only a article number.
When the search finds a match, i need the macro to return the full name of the path including whatever the "*" represents
Code:
Sub Picpath()
Dim Picpath As String
fpath = "S:\Applications\Uniflow\Productdrawings\Picture Iproduct\"
NoPicPath = "S:\Applications\Uniflow\Productdrawings\Picture Iproduct\photo_not_available.jpg"
For I = 12 To lr
Picpath = fpath & wsmaster.Cells(I, ColItem).Value
If Dir(Picpath & "*.jpg") <> "" Then
wsmaster.Cells(I, ColPic) = Picpath & ".jpg"
ElseIf Dir(Picpath & "*.png") <> "" Then
wsmaster.Cells(I, ColPic) = Picpath & ".png"
Else
wsmaster.Cells(I, ColPic) = NoPicPath
End If
Next
End Sub