Open a picture externally

jesusoneez

IT Dogsbody
Local time
Today, 00:28
Joined
Jan 22, 2001
Messages
109
I have the following code;

Code:
Private Sub cmdProof_Click()
    Dim MyFilePath As String
    
    MyFilePath = "N:\Pictures\" & Me.txtBanID.Value & ".jpg"
    MsgBox MyFilePath
    Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE", MyFilePath, "", vbMaximizedFocus)
End Sub

I know the mistake is in the Call Shell line at the point of MyFilePath, but I don't know how to fix it.

EDIT: The error being wrong property argument.

Thanks for any help.
 
Last edited:
I think you need to concatenate the path/Filename like this
("C:\Program Files\Internet Explorer\IEXPLORE.EXE " & myFilePath
 
Nope, I had tried that before the code I posted above.

Changing it to this;

Code:
Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE" & MyFilePath, "", vbMaximizedFocus)

produces the same error;

Wrong number of arguments or invalid property assignment.
 
The wrong number of arguments is because windows evaluates
C:\Program Files\Internet Explorer\IEXPLORE.EXE as 3 paramaters because of the spaces. add aditional single quotes around the path and filename to prevent this.

Code:
"'C:\Program Files\Internet Explorer\IEXPLORE.EXE" & "' '" & MyFilePath & "'"
 
Thanks PeterF. That's great to know for future reference but I just discovered Application.FollowHyperlink and used that instead.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom