Win11 and MSPaint

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15615
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Win11 and MSPaint

Post by ChrisGreaves »

Code: Select all

(1) 	' Shell "C:\Windows\System32\mspaint.exe """ & strFullname & """""", vbMaximizedFocus
(2) 	Dim strCommand As String
(3) 	strCommand = "C:\Program Files\WindowsApps\microsoft.paint_11.2301.22.0_x64__8wekyb3d8bbwe\mspaint.exe """ & strFullname & """"", vbMaximizedFocus"
(4) 	strCommand = "C:\Program Files\WindowsApps\microsoft.paint_11.2301.22.0_x64__8wekyb3d8bbwe\mspaint.exe "
(5) 	strCommand = "mspaint.exe "
(6) 	Shell "mspaint.exe """ & strFullname & """""", vbMaximizedFocus
(7) 	Shell strCommand
So I have this cute macro to edit an image inside a MSWord document. Then I switch from Win7/10 to Win11 and my VBA code breaks down.

Line (1) is the original code until 1600 today
Lines (5) through (7) are working now.
For years my code has had a hard-coded reference to the MSoft Windows application MSPaint.exe - that's what you see in line(1).

I used Everything1.5a (naturally!) to locate MSPaint,exe and found it in this folder:-

Code: Select all

C:\Program Files\WindowsApps\microsoft.paint_11.2301.22.0_x64__8wekyb3d8bbwe\PaintApp
But the Shell command objects.

There follows five minutes of experiment, which terminates when I discover that I do not need the Fullname of the application; the name alone suffices.

In a few days time I will have the energy to go back and tidy up my code.

Cheers, Chris
There's nothing heavier than an empty water bottle