Opening a jpg file

J

Jack

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
 
T

Ted Allen

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top