Solved Force BMP to open using PhotoViewer (1 Viewer)

Jason Lee Hayes

Active member
Local time
Today, 14:47
Joined
Jul 25, 2020
Messages
175
Windows 11
Access 2016 32bit


I have a form with an image control that displayes a picture in BMP format.

I wish to open the BMP when i double click and use the OS Photo Viewer as the default application to open it.

So; you would think i could set the default .bmp extension in OS to open in Photo Viewer but it never does?
Ideally i don't wish to make this perminent either and only wish to use PhotoViewer whilst in my MS Access project.

I am opening the file in MS Access VBA using the Application.FollowHyperlink Method

I can see the PhotoViewer is actually a Dynamic Link Library (.dll) not an executable (.exe)
Its location on my pc is "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll"

I've done some googling and below is the line i likely need to call via shell:-

rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen path_to_image

I'm not sure how to call this as a shell command written in VBA

Can anyone help please?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:47
Joined
Oct 29, 2018
Messages
21,473
I think you almost got it. Try using the Shell command.
 

Jason Lee Hayes

Active member
Local time
Today, 14:47
Joined
Jul 25, 2020
Messages
175
I think you almost got it. Try using the Shell command.
I've sorted it... Still cannot fathom why i tell my OS to open .BMP in Photo Viewer as default and it does outside of MS Access but within MS Access it just does not work...

I added Shell but then received an argument error - maybe me not adding it correctly so i tried the following which does not specify Photo Viewer and it works?? Maybe Photo Viewer is bound by default to explorer or something... It works anyway....

Call Shell("explorer.exe " & ImagePathSnap, vbNormalFocus)

Thanks for the quick reply theDBGuy

Regards,

Jason
 

Attachments

  • ShellOpenBMPNowWorking.zip
    2.3 MB · Views: 97

theDBguy

I’m here to help
Staff member
Local time
Today, 06:47
Joined
Oct 29, 2018
Messages
21,473
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom