在UserForm中添加一个CommandButton
Dim WithEvents PyScript As MSScriptControl.ScriptControlPrivateSub CommandButton1_Click()如果PyScript是Nothing,则设置PyScript = New MSScriptControl.ScriptControl PyScript.Language
谁知道在VB .Net中是否可以使用MSScriptControl.ScriptControl来控制python,就像在excel中一样?这将比为我的python脚本设置一个com对象容易得多。需要添加微软脚本控件1.0和excel对象库): Dim WithEvents PyScript As MSScriptControl.ScriptControlxlwbook.Worksheets(1), Excel.Worksheet)