[Visual Basic] 复制代码 Dim pyEnviroment
Sub UserForm1_Initialize()
Set pyEnviroment = CreateObject("Stock.Python")
ref = pyEnviroment.ImportModule("jzt_py_test")
If ref <> 1 Then
msg = pyEnviroment.GetErrorInfo()
MsgBox msg
Set msg = Nothing
Exit Sub
End If
End Sub
Sub UserForm1_CommandButton1_Click()
r = pyEnviroment.CallObject("test", "tt")
r = pyEnviroment.CallObject("test", "tt111")
r = pyEnviroment.CallObject("test", "中华人民共和国")
r = pyEnviroment.CallObject("test", "dk938eicv#8I^&")
End Sub
[Python] 复制代码 # -*- coding: utf-8 -*-
# 该Python代码用于模块定义,供其他Python代码或VBA调用。
from PythonApi import *
def test(param1):
print(type(param1))
print(param1)
return 1 |