when I execute a an Xlwings function I can save and close the workbook. But I cannot close Excel 2016 anymore. Is this a known issue? How can I fix this?
27.0 and v0. 27.1 (Mar 8, 2022) Feature PRO This release adds support for xlwings Server to the Excel Desktop apps on both Windows and macOS. The new VBA function RunRemotePython is equivalent to runPython in the JavaScript modules of Google Sheets and Excel on the web, see xlwings Server (GH1841).
Xlwings makes automating Excel with Python easy and can be used for- generating an automatic report, creating Excel embedded functions, manipulating Excel or CSV databases etc.
To make this run, just import the VBA module xlwings. bas in the VBA editor (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.
Here is how I got it to work:
import xlwings as xw
wbPath = [WorkbookPath]
wb = xw.Book(wbPath)
app = xw.apps.active
wb.save(wbPath)
#wb.close()
app.quit()
Note that I commented out the line wb.close()
. You can skip this step and instead set the app = active Excel instance, save the workbook, and then quit the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With