I found xlwings is a very exceptional project as a bridge between Excel and Python. So I am applying it to my excel addin development.
But I got some problem.
When excel addin calls python module, the Workbook.caller() does not return Workbook object(addin workbook itself)! Just Error!
Instead of Workbook.caller(), I make use of 'Workbook() passing by 'Current ActiveWorkbook's name'. But in that case, I'm afraid that 'Optimize_connection= true' may raise memory garbage issue!
(If 'IsAddin' property in VBA is off, then it runs very well)
Is there anyone to help me?
Thank you in advance.
Here's a work-around to get the Excel add-in that's calling Python code:
It works with Python 3.4 and xlwings 0.6.4 on:
I have not tested this, but the solution may be as simple as replacing
ThisWorkbook
withActiveWorkbook
when using the xlwings VBA module as add-in. Anyhow, I've created an issue to get this resolved: https://github.com/ZoomerAnalytics/xlwings/issues/153