Advertisement
g96

Untitled

g96
Feb 10th, 2022
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Sub RunPythonScript()
  3.  
  4. 'Declare Variables
  5. Dim objShell As Object
  6. Dim PythonExe, PythonScript, cmd As String
  7.  
  8. 'Create a new Object shell.
  9. Set objShell = VBA.CreateObject("Wscript.Shell")
  10.  
  11. 'Provide file path to Python.exe
  12. 'USE TRIPLE QUOTES WHEN FILE PATH CONTAINS SPACES.
  13. PythonExe = """C:\Users\gobro7\AppData\Local\Programs\Python\Python39\python.exe """
  14. PythonScript = """C:\Users\gobro7\Digital Wholesale - Documents\2. Amazon\Customer Operations_OTC\02. Amazon weekly Report\Amazon weekly automation (Giorgi)\VL.py"""
  15.  
  16. cmd = PythonExe & PythonScript
  17. Debug.Print cmd
  18.  
  19. 'Run the Python Script
  20. objShell.run cmd, 0, True
  21.  
  22.  
  23.  
  24.  
  25. MsgBox "Finished"
  26.  
  27. End Sub
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement