I have an input file in Excel which is used in a Python script solver.py. When I run the Python script, the outputs are printed in a different .xlsx file. I want to call the python script directly from the input file. I use the following code:
Dim objShell As Object
Dim PythonExe, PythonScript As String
Set objShell = VBA.CreateObject("Wscript.Shell")
PythonExe = "C:*PATH*\Anaconda3\python.exe"
PythonScript = "C:*OTHERPATH*\solver.py"
objShell.Exec PythonExe & " " & PythonScript
ActiveWorkbook.UpdateLink Name:= _
"C:*OTHERPATH*\output.xlsx", Type:= _
xlExcelLinks
The last line is irrelevant, but when I manually change the output file and call the code, the values are updated. So I know for sure that this code runs completely. However, solver.py is never called. I see the black screen flashing shortly, but that's it, no calculations are made.
Why is solver.py not called? Is there any way to check what goes wrong, since I get no error messages?