我可以在VBA中使用python自定义对象吗?

我可以在VBA中使用python自定义对象吗?,python,excel,vba,com,Python,Excel,Vba,Com,很明显,在excel/VBA中有使用python函数的选项 但是,我正在寻找在VBA中使用python对象的方法。在我的理想世界里,我只能做这样的事情: dim car1 as object dim car2 as object dim road as object set road = CreateObject("MyPythonLib.road") set car1 = CreateObject("MyPythonLib.car") set car2 = CreateObject("MyP

很明显,在excel/VBA中有使用python函数的选项

但是,我正在寻找在VBA中使用python对象的方法。在我的理想世界里,我只能做这样的事情:

dim car1 as object
dim car2 as object
dim road as object

set road = CreateObject("MyPythonLib.road")
set car1 = CreateObject("MyPythonLib.car")
set car2 = CreateObject("MyPythonLib.car")

road.add(car1)
road.add(car2)

上次我检查时,Excel VBA仅限于有限的.NET Framework集。也就是说,如果你想把Python翻译成C,你仍然可以调用C。

你有没有找到用Python制作COM DLL组件的方法?或者服务器应用程序?以及设置InProcServer32或LocalServer32、CLSID、ProgId等?还有可能创建一个类型库,以便可以在VBA中检查Python对象?