Wednesday, April 13, 2022

[SOLVED] VBA Shell no longer working in Windows 11

Issue

I recently updated to Windows 11 and I notice that the Shell call does not longer open the Notepad.

It seems that Windows 11 now has notepad in the "C:\Windows" directory as well as the "C:\Windows\System32" directory but when I run this command using either, it no longer opens the notepad, it just runs and nothing happens

Dim x As Variant
x = Shell("C:\Windows\system32\notepad.exe ""C:\test.txt""")

Is anyone else experiencing this behavior or found a way around it?


Solution

Adding vbNormalFocus did the trick. Thank you David



Answered By - R Gomez
Answer Checked By - Candace Johnson (WPSolving Volunteer)