Quiero cargar una imagen de equiz extencion .bmp . jpg etc atravez del nombre pero el problema esta ahi osea si intento cargar imagen.bmp y el archivo se llama imagen.jpg entonces me tira error.
Actualmente lo hago asi pero hay algun otro metodo o como lo hago correctamente.
Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long
Private Sub Command1_Click()
If CStr(CBool(PathFileExists(App.Path & "\xarchivo.jpg"))) = True Then
MsgBox "existe xarchivo.jpg"
ElseIf CStr(CBool(PathFileExists(App.Path & "\xarchivo.bmp"))) = True Then
MsgBox "existe xarchivo.bmp"
ElseIf CStr(CBool(PathFileExists(App.Path & "\xarchivo.gif"))) = True Then
MsgBox "existe xarchivo.gif"
Else
MsgBox "no existe ningun archivo del tipo imagen"
End If
End Sub