Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute python code from excel vba

Status
Not open for further replies.

babun1

Structural
Jun 30, 2010
6
I was trying to execute python code from excel macro. But error is displayed as "Run-time error '70': Permission denied.". Code is simple as below.

Sub RunPython2()

Dim objShell As Object
Dim PythonExe, PythonScript As String

Set objShell = VBA.CreateObject("Wscript.Shell")
PythonExe = """C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\python.exe"""

PythonScript = "D:\personal\python_Work\Python_Path\test.py"

objShell.Run PythonExe & PythonScript
End Sub

Need help to resolve the issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor