I have been writing some Python Scripts and I would like to call them from my Excel application as an Add-In or Makro. Right now I am simply using VBA to start up Python and execute the script with the following code:
Sub AutoMail()
Dim objShell As Object
Dim PythonExe, PythonScript As String
Set objShell = VBA.CreateObject("Wscript.Shell")
PythonExe = """J:\Strasser\My_PythonInterpreter\Scripts\python.exe"""
PythonScript = "J:\Strasser\Strasser_Py_Tests\main.py"
objShell.Run PythonExe & PythonScript
End Sub
Some remarks regarding this specific script: It opens a "tkinter" Input window, does some calculations and opens the results in a new Excel sheet. (These results will then be used in the current Excel workbook..)
My question is, what is the "right" way to do this?
It should be quit fast and somewhat easy to use for my collegues and if possible for free (I have seen that I would have to buy for PyXLL for example.)
Thanks in advance for any responses!