Hide the cmd window while executing the python code from vba

Viewed 22

I have a task to execute multiple .py files from vba. However, every time I execute the python code from vba , I am getting cmd console, how can I hide those consoles. Below is the sample code which I am running. please guide as it is messing up each time, when I am running multiple python files.

Dim oCmd As String
Dim arg As Variant
Dim strOutput

   arg = "Arg1"
   oCmd = "python ""C:\Tools\test_api.py""" & " " & arg
   strOutput = CreateObject("WScript.Shell").Exec(oCmd).StdOut.ReadAll()
   Debug.Print strOutput
0 Answers
Related