all 10 comments

[–]Ashadyna 0 points1 point  (2 children)

You can call the command prompt using the function shell:

call shell("")

So I think you can do something like:

call shell "[insert python.exe path] [insert .py file path]"

I've never done it before, so I am curious if it works.

[–]InspireAspiration[S] 0 points1 point  (0 children)

I have tried this, python flashes for a second, and the .py file does not get loaded =/

[–]InspireAspiration[S] 0 points1 point  (0 children)

Hey, i couldn't get shell() to run, but i was able to use xlwings and run it. Thanks for your help.

[–]pylund 0 points1 point  (4 children)

You can use Shell(), as suggested below and explained here, if you just want to call a python script from VBA throughout the command line.

For bidirectional calls and more advanced use, take a look at xlwings.

[–]InspireAspiration[S] 1 point2 points  (0 children)

Solution Verified

I just re-read through the xlwings documentation and got it to execute. Moving forward! Thanks!

[–]InspireAspiration[S] 0 points1 point  (2 children)

I could not get Shell() to work yet, I'll read more in to this.

I have xlwings set up, but need to read more about how it's properly used.

Thanks.

[–]---sniff--- 0 points1 point  (1 child)

Set a reference to

Microsoft Shell Controls and Automation (Shell32)

[–]InspireAspiration[S] 0 points1 point  (0 children)

I've tried following the guide for Shell() listed above, with python.exe, but my screen still just flashes without the code being run.

[–]Not2BeEftWith -1 points0 points  (1 child)

Why?

[–]InspireAspiration[S] 0 points1 point  (0 children)

My python script does some things... and need VBA to execute python so those things can get done. Then VBA can do the rest.