2
votes

I have just changed computer and Im now getting this error "Run of Object IwshShell3 failed". Im running the macro from MS Access.

the code is:

Set wsh = VBA.CreateObject("WScript.Shell")
wsh.Run strFileName               'execute file

Old computer Access version is office 2013. current version Microsoft Office 365 ProPlus. Ive tried referencing Windows Script Host Object Model. Are there any other references that I need?

2
The builtin shell() can execute a program, if thats all you need simply get rid of that code. - Alex K.
hi alex. so would that be shell(strFileName) - Ian Cox

2 Answers

2
votes

You can simply use Shell

e.g.

Public Sub test()
    Shell "notepad", vbNormalFocus
End Sub

You can use longer versions e.g.

CreateObject("wscript.shell").exec "cmd /c notepad"
0
votes

This problem cause by the incorrect path of Python. Python should be install in the folder that folder name shouldn't have space.