MSOffice error message (1 Viewer)

John Sh

Member
Local time
Today, 23:27
Joined
Feb 8, 2021
Messages
410
I am using this code to display images,

Code:
Public Sub showPic(str As String)
    DoCmd.SetWarnings False
        Application.FollowHyperlink str
    DoCmd.SetWarnings True
End Sub

If the image is a JPG it displays in the default viewer without an error message
If the image is a raw, .nef, image I get the error message below.

Is there a way to stop this message?
Screenshot_23.jpg
 

tvanstiphout

Active member
Local time
Today, 06:27
Joined
Jan 22, 2016
Messages
222
I don't know what .nef files are, but did you try making this folder a Trusted Location?
 

John Sh

Member
Local time
Today, 23:27
Joined
Feb 8, 2021
Messages
410
I don't know what .nef files are, but did you try making this folder a Trusted Location?
Hi Tom. .nef files are raw photos from a Nikon camera, like CR2 from a canon. These are the unprocessed files some cameras produce and have much more detail than a .JPG.
No, I didn't try trusted location but will do.
Thank you for the suggestion.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:27
Joined
May 7, 2009
Messages
19,245
how about using:
Code:
Public Sub showPic(str As String)
    CreateObject("WScript.Shell").Run str
End Sub
 

John Sh

Member
Local time
Today, 23:27
Joined
Feb 8, 2021
Messages
410
how about using:
Code:
Public Sub showPic(str As String)
    CreateObject("WScript.Shell").Run str
End Sub
Do I need a reference for that, it crashed as is.
Just checked, I've already got windows script host object module
Setting the folder as trusted didn't work either.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:27
Joined
May 7, 2009
Messages
19,245
Do I need a reference for that, it crashed as is.
you don't need any reference. The thing is you need to Associate the .nef file first with your Windows Photo (or whatever the default photo viewer) by opening first .nef file from windows (outside ms access). After you have associated the file, you can run your Public Sub.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:27
Joined
May 7, 2009
Messages
19,245
there is another alternative though:
Code:
Public Sub showPic(str As String)
    CreateObject("Shell.Application").Namespace(0).ParseName(str).InvokeVerb "Open"
End Sub
 

John Sh

Member
Local time
Today, 23:27
Joined
Feb 8, 2021
Messages
410
That works. The first one crashed with "Method "run" failed.
Once again my thanks for your valuable input
John
 

Users who are viewing this thread

Top Bottom