Open image (1 Viewer)

geno

Registered User.
Local time
Today, 01:01
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
 

Estuardo

Registered User.
Local time
Today, 01:01
Joined
May 27, 2003
Messages
134
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
 

geno

Registered User.
Local time
Today, 01:01
Joined
Jun 19, 2000
Messages
243
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
 

Estuardo

Registered User.
Local time
Today, 01:01
Joined
May 27, 2003
Messages
134
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
 

geno

Registered User.
Local time
Today, 01:01
Joined
Jun 19, 2000
Messages
243
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
 

Estuardo

Registered User.
Local time
Today, 01:01
Joined
May 27, 2003
Messages
134
May be you need to add some time to make it work. here is a full documentation.
G'd luck
 

geno

Registered User.
Local time
Today, 01:01
Joined
Jun 19, 2000
Messages
243
Thanks, i'll give it a read.
 

Users who are viewing this thread

Top Bottom