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 like to know 1 How can i call the python function from the VBA code 2 pass the active workbook to this code?
Asked
Active
Viewed 1,883 times
2 Answers
1
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.

JMax
- 26,109
- 12
- 69
- 88

Tony Roberts
- 387
- 1
- 5
0
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.

Community
- 1
- 1

Bojan Nikolic
- 1,296
- 12
- 8