1

I am pretty new to this. I am trying to get a python script to run through excel I need to use excel because that is what the people I work with understand. I'm stuck because my python script works but I can't get it to work in VBA ideally I need it to run as a function one that I can run on a nearby cell just like any other formula.

my python script is pretty basic and just returns one output for every input.

I know this won't do what I need it to do but I'm not sure why it just pops up the command window and doesn't do anything else.

Sub runpython()

Dim objShell As Object
Dim PythonExe, PythonScript As String

    Set objShell = VBA.CreateObject("Wscript.Shell")

    PythonExe = """C:\Program Files (x86)\Python38-32\python.exe"""
    PythonScript = """Python path"""

    objShell.Run PythonExe & PythonScript

End Sub
4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.