Open image

geno

Registered User.
Local time
Today, 13:03
Joined
Jun 19, 2000
Messages
243
Hi,

Need help to double click an image on a form and have it open up in windows office picture manager.

Thanks
 
G'd evening,
Use the vba.shell function like this

Code:
 Dim strOfile As String
    Dim strApp As String
   

        strApp = "C:\Program Files\Microsoft Office\Office14\ois.exe"
        strOfile = "C:\ThisImage.jpg"
        vba.Shell strApp & " " & Chr(34) & strOfile & Chr(34), vbMaximizedFocus

G'd luck
 
Thanks for your reply.

I tried your code but got an error on the VBA.Shell line:

Private Sub Img1_DblClick(Cancel As Integer)

Dim strOfile As String
Dim strApp As String

strApp = "C:\Program Files\Microsoft Office\Office14\ois.exe"
strOfile = "\\geno-pc\4WheelPics\" & Forms!frmLookupPartNO.[PartID] & ".jpg"
VBA.Shell strApp & " " & Chr(34) & strOfile & Chr(34), vbMaximizedFocus

End Sub

Can you see anything why this would be?

Thanks

Gene
 
The problem is not the code. Get the content of your var strOfile and make sure that it is a full path file.

Code:
strOfile = "\\geno-pc\4WheelPics\" & Forms!frmLookupPartNO.[PartID] & ".jpg"
Debug.print strOfile
 
The debug shows the path correct. The line highlighted is the VBA.Shell line.
The image is brought into the image control on the form from this path and it shows correctly. So I don't think it is a problem with the path. I'll do more research on this...thanks for your help.

Gene
 
May be you need to add some time to make it work. here is a full documentation.
G'd luck
 

Users who are viewing this thread

Back
Top Bottom