I am using mac OS X Sierra with Mac for Ecel 2016 and python 3.6. I am trying to launch a python script from excel because:
- I already have an excel with a lot of functionalities and I would like to add some features to this product using Python.
- The users of my product won't be comfortable launching python scripts from a python console, so I'd like to have some kind of excel user interface.
I am providing this background because I am open to suggestions on how to do differently. From my researches so far, it seems that this can be done using the xlwings library. I have tried using it following the instructions on:
http://docs.xlwings.org/en/stable/vba.html#vba
I am somehow stuck at this stage:
Open the VBA editor with Alt-F11 Then go to File > Import File... and import the xlwings.bas file. It can be found in the directory of your xlwings installation.
As alt + F11 doesn't open the macro editor, I have understood the instructions as follows:
- click on the 'macros' button in the 'developper' tab of excel
- create a new macro / edit an existing one
- go to 'add references' on the bottom left corner
- open the file mentioned
The issue is that I can't open the xlwings.bas file ; I can only open some of the files. I managed to open a file called xlwings.xlsm ; that creates a new tab called 'xlwings' on Excel, in which there is one button: 'import Python UDFs'. When I press this button it throws the error :
Run-time error '53': File not found: xlwings64.dll
In one of my previous attempts using xlwings, I had a different error at this stage. I cant remember it, but from my researches the solution implied doing something on the trust center of excel 2016 which I couldn't do with Excel for Mac 2016.
Alternatively, when I try to run a macro using RunPython, it throws the following error :
Compile error: Sub or Function not defined
Pointing at RunPython...
If someone knows what I did wrong and/or how I can manage to use xlwings, that would be great.
Thank you for the help,