Hi--In Excel, I need to programmatically insert a call to the interesting new PY( ) function in a worksheet cell, with return as an Excel value (not python object). Tried repeatedly using a few different ways, but all failed--see simple example below that shows how I tried, and the resulting errors).
Note that manually creating a PY( ) call with exactly the same test python code works fine, so clearly I'm doing the "insert from VBA" wrong. Searched but did not find anything online on this. Anyone succeeded in doing this, please?
Would be grateful to hear from anyone who's succeeded in doing this, or who can point me to any Microsoft guidance on this specific problem (I failed to find such).
Thanks,
Rob
Details:
========
Environment:
Windows Prof 64bit, Office 365, Excel 32bit (Insider Beta ver 2311 build 16.0.17005.20000)
Simple steps to recreate problem:
- Create a new .xlsm workbook (single worksheet)
- Create a VBA module, and define subroutine TestPyInsert() (see below)
- Run this subroutine, wait for newly-created PY() call to complete,
then save & close workbook
- Re-open the workbook--Excel pops up 2 ~error messages:
1) "We found a problem with some content in <mywkbk.xlsm>.
Do you want us to try to recover as much as we can? ..."
2) "Repairs to <mywkbk.xlsm>: Excel was able to open the file
by repairing or removing the unreadable content.
(...then lists 2 removed records--calc chain corruption?)
Please Login or Register to view this content.
Bookmarks