Relating to a question in my previous post
in which David Marten inquired about doing the same in MS Photos, I decided to look into the matter.
I was surprised at that I couldn’t locate any examples of this. The only ones that would work were if MS-Photos was already defined as the system’s default image editor, then you could use any approach to launch the file and it would obviously open in MS-Photos (nothing easier that FollowHyperlink). Sadly, having MS-Photos as the default editor is not likely and messing with users’ registry wasn’t an avenue I wanted to use.
I went through 100s of threads and not 1 worked!
Launching MS-Photos
Simply opening MS-Photos is pretty easy. This you can find some threads on, quite often using PowerShell though, but there are examples that exist.
Below are ones that worked for me when I explored all of this:
Option 1
Shell "explorer.exe shell:AppsFolder\Microsoft.Windows.Photos_8wekyb3d8bbwe!App"
Option 2
Shell "explorer.exe ms-photos:"
Option 3
CreateObject("WScript.Shell").Run("ms-photos:")
Opening an Image in MS-Photos
Now opening a file directly in MS Photos, I couldn’t find a single example anywhere. I don’t know if my GoogleFoo was lacking or, but I played around with PowerShell and VBA for hours and eventually found a syntax that worked!!!
Shell "explorer.exe ms-photos:FilePath=C:\Temp\MyTestImage.png"
Where did FilePath come from, PowerShell. I’ve used it for other cmdlets, so I randomly tried it, and it worked here! Simply luck in this instance.
Once we know the basic syntax, we can turn that into a simple function like:
'---------------------------------------------------------------------------------------
' Procedure : MSP_OpenImage
' Author : Daniel Pineault, CARDA Consultants Inc.
' Website : http://www.cardaconsultants.com
' Purpose : Open the specified image in the MS Photos app
' Copyright : The following is release as Attribution-ShareAlike 4.0 International
' (CC BY-SA 4.0) - https://creativecommons.org/licenses/by-sa/4.0/
' Req'd Refs: None required
' References: (found after having developed this!)
' https://learn.microsoft.com/en-us/windows/uwp/launch-resume/launch-default-app
'
' Input Variables:
' ~~~~~~~~~~~~~~~~
' sImg : Fully qualified path and filename of the image to open
'
' Usage Example(s):
' ~~~~~~~~~~~~~~~~~
' Call MSP_OpenImage("C:\Temp\TestImage.png")
'
' Call MSP_OpenImage("C:\Temp\Img_01.jpg")
'
' Revision History:
' Rev Date(yyyy-mm-dd) Description
' **************************************************************************************
' 1 2023-04-17 Initial Release
' 2 2023-04-17 Added viewer? to URI per referenced article
'---------------------------------------------------------------------------------------
Sub MSP_OpenImage(sImg As String)
On Error GoTo Error_Handler
Shell "explorer.exe ms-photos:viewer?FilePath=" & sImg
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Source: MSP_OpenImage" & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Sub
Note: Do not add quotes to the File Path (even if there are space in the path string) it will make the command/function bomb.
An Alternate approach could be to do
CreateObject("WScript.Shell").Run("""ms-photos:viewer?fileName=C:\Temp\MyTestImage.png""")
Using PowerShell
I’m not going to make an extensive posting about doing this using PowerShell but here is an example that you can always build upon should you wish to.
Launch MS Photos
Start-Process "shell:AppsFolder\Microsoft.Windows.Photos_8wekyb3d8bbwe!App"
Opening an Image in MS-Photos
Start-Process "shell:AppsFolder\Microsoft.Windows.Photos_8wekyb3d8bbwe!App" -FilePath "C:\Temp\Img_01.jpg"
Or
explorer "ms-photos:viewer?fileName=C:\Temp\Img_01.jpg"
Just figuring out ‘Microsoft.Windows.Photos_8wekyb3d8bbwe!App’ required checking the Windows Default Apps, cross referencing that in the Registry, … just a nightmare!
Weren’t computers going to simplify things. It seems to me that Microsoft, in recent years, has been making things more difficult.
Minor Update – 2023-04-17
Murphy’s Law. After figuring things out through trial and error, and now knowing what to properly search for, I finally came across a useful MS article which covers the ms-photos: options. Hopefully it can help a few of you out there.

Nice work, Daniel!
Thanks for persevering! I gave up at the requirement for elevated permissions.
In VBA, I invoke VB Script to do this kind of thing. E.g.:
Sub OpenPic()
Dim ws As Variant
Set ws = CreateObject(“WScript.Shell”)
ws.Run “file:///D:\My%20Pictures\My%20Pic.jpg”
End Sub
This will open the file “D:\My Pictures\My Pic.jpg” in whatever default program the user has set for opening this particular file type. This works for video files, or any file that has a default application. The only caveat is that all spaces in the path must be replaced with the hexadecimal ASCII value for space (%20), just like in Internet URLs. But this can be easily done with the Replace() function on the string.
There are a number of techniques for opening files in their default programs, I covered a few in my article: https://www.devhut.net/vba-opening-files-and-urls/. I even briefly mention the WScript.Shell approach in Option 3 of the VBA section of this article.
That said, this article pertained to working specifically with the MS Photos application though.