Calling python code from VSTO excel addin
I am working on an excel2007 plugin in VSTO and am using VB for coding it. One of the item in the plugin is the button, pressing which should give a call to a python program which will add some data to the current worksheet. I would l开发者_运维技巧ike to know 1 How can i call the python function from the VBA code 2 pass the active workbook to this code?
you can use PyXLL
to call a python function from Excel either as a worksheet function or as a macro which you can call from VBA. If you look at the docs for xl_macro
on the PyXLL website you'll find an example of how to do that.
You may want to also consider integrating Python and Excel via COM as this does have a fair amount of flexibility. See Driving Excel from Python in Windows .
For a Python add-in loaded directly in Excel I have also published a simple implementation at http://www.bnikolic.co.uk/expy/expy.html that is free and with source code.
精彩评论