Opening a jpg file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box that has the path and file name of the jpg file that I
would like to open. I would like to write a code to the onclick property of
the textbox, so when the user clicks on the textbox, the picture will open
with the default picture viewer.
Does anyone know that code to make this happen..

thanks
 
Hi Jack,

I think that:

Application.FollowHyperlink Me.YourControlName, , True

or,

strFile = Me.YourControlName
Application.FollowHyperlink strFile, , True
(same thing, just more standardized).

Should work. The True is to open in a new window. You can find more info
by highlighting Application.FollowHyperlink in the VBA window and pressing F1.

HTH, Ted Allen
 
sorry jack.
you will have to put a image control on the form.
load the path into the image control's picture property

Private Sub textbox_Click()
Dim picpath As String
picpath = yourtextbox
Image1.Picture = LoadPicture(picpath)
End Sub
 
Back
Top