MSOffice error message

John Sh

Member
Local time
Today, 20:32
Joined
Feb 8, 2021
Messages
508
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
 
I don't know what .nef files are, but did you try making this folder a Trusted Location?
 
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.
 
how about using:
Code:
Public Sub showPic(str As String)
    CreateObject("WScript.Shell").Run str
End Sub
 
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:
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.
 
there is another alternative though:
Code:
Public Sub showPic(str As String)
    CreateObject("Shell.Application").Namespace(0).ParseName(str).InvokeVerb "Open"
End Sub
 
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

Back
Top Bottom