Dan Jackson
Dan Jackson

Reputation: 247

How to run an exe file with VBA Excel 2016 for Mac

I have some python code that I've converted to an executable file and need to run from an excel macro (I'm using Excel 2016 on a Mac).

I'm trying to run it as follows:

Sub RUN_JENSEN()

    Shell ("/Users/DanielJackson1/Desktop/auto-py-to-exe-master/output/Wakes/Wakes.exe" & "/Users/DanielJackson1/PycharmProjects/Wakes/Wakes.py")

End Sub

but I get the error

Run-time error '76':
Path not found

I am 100% certain the both paths are correct, so has anybody else had this problem or have any suggestions?

Thanks, Dan

Upvotes: 0

Views: 706

Answers (1)

fractals
fractals

Reputation: 856

& in VBA is string concatenation, so your code is basically

Shell ("/Users/DanielJackson1/Desktop/auto-py-to-exe-master/output/Wakes/Wakes.exe/Users/DanielJackson1/PycharmProjects/Wakes/Wakes.py")

which probably is not a valid path.

You cannot run exe files on a Mac (unless you have something installed) by the way, and since it looks like the exe file is basically the python file compiled, why not just use the Python interpreter and run Wakes.py?

Upvotes: 3

Related Questions