user2662434
user2662434

Reputation: 99

How to compile a Python module to dll and call it in VBA

I want to create a user defined function written in Python. Then I want to compile it to a dll, and distribute it and call in EXCEL vba on another computer which doesn't have python installed.

For example, I want to create a function in Python:

def add(a,b): return a+b

Then, compile it and export it as a dll. On another computer without Python, I can to import this function in EXCEL vba and use it. How to do it?

Thanks,

Upvotes: 5

Views: 11462

Answers (1)

Sol Stein
Sol Stein

Reputation: 656

in excel go to the vbe editor Tools>References browse your dll and add a reference, this will make available your dll functions in vba.

as per making it a dll, look what jb suggest here How to compile a Python package to a dll and follow the comments on that as well.

another option would be like stated here https://code.google.com/archive/p/shedskin/

Upvotes: 4

Related Questions