I cannot close Excel 2016 after executing a xlwings function

点点圈 提交于 2019-12-04 08:40:19

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41089223/i-cannot-close-excel-2016-after-executing-a-xlwings-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!