【Python】如何在VBA中调用Pyt

背景:

已有一个Python脚本实现了部分功能,想使用VBA直接调用Python脚本

Python脚本如下:

import time  def hello(name):  	return "Hello, " + name + "!"    print hello("World")  #延时关闭windows控制台,使得用户可以看到运行结果  time.sleep(150); 

方法如下:

<pre name="code" class="vb">Sub test()        Call Shell("C:Python27Python.exe C:UsersHongxingDesktoppy2exeHello.py", vbNormalFocus)    End Sub