I have a python code that create a image (jpg format). This code works in jupyter and visual studio code. I'm trying to execute the code from the same excel that the code import the data. The idea is to have a button in the excel to execute the python code and obtain the image.
The code that I'm using to execute the python code in VBA is:
Sub RunPythonScript_1()
Dim objShell As Object
Dim PythonExePath, PythonScriptPath As String
Set objShell = VBA.CreateObject("Wscript.Shell")
PythonExePath = """C:\Users\227871\AppData\Local\Microsoft\WindowsApps\python.exe"""
PythonScriptPath = """C:\Users\227871\OneDrive - Weir Group PLC\Francisca\Mejora App Weir\Balance\Balance Collahuasi\Balance 1.py"""
objShell.Run PythonExePath & PythonScriptPath
End Sub
When I run the code, it doesn't show me errors. Just appears the console one second and after it closes.
Please, could you help me with this??
I expected that when I use the button in excel, a image appears.