Why does 'shell' opening an executable in a Visual Basic Script sometimes give a 'run time error 5' but not always?

Viewed 46

I am playing around with the basics of VBS and have a very simple Visual Basic script which executes a file using shell. I am using Excel under Windows 10.

Sub Whatever()

Dim Example_One As String
Example_One = "C:\Users\IEUser\python-3.8.0.exe"
Shell Example_One, vbNormalFocus

End Sub

The weird thing is that some files will run (e.g. Python as above) while others e.g. VLC, WinRAR give the error: Run time error 5: Invalid procedure call or argument.

I simply cannot figure out why some .exe files will run and others will not. I thought it might be something to do with how the installation works but ChromeSetup.exe works while VLC.exe does not (even though they both ask "Do you want this app to make changes to your device?" (Python has it's own installer). Double-clicking all files in Windows Explorer runs them as normal (they don't ask for any special rights).

0 Answers
Related