Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Jun 30, 2010
Messages
6
Location
IN
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

Back
Top