如何在不保存的情况下退出 win32com Excel?
How to Quit Excel with win32com, without saving?
当我执行 xl.Quit() 时,Excel 总是弹出一个提示,询问我是否要保存。怎么告诉它我不想保存?
xl = Dispatch('Excel.Application')
xl.Workbooks.Open('New Workbook.xlsx')
# do some stuff
xl.Quit()
from win32com.client import Dispatch
# Start excel application
xl = Dispatch('Excel.Application')
# Open existing excel file
book = xl.Workbooks.Open('workbook.xlsx')
# Some arbitrary excel operations ...
# Close excel application without saving file
book.Close(SaveChanges=False)
xl.Quit()
当我执行 xl.Quit() 时,Excel 总是弹出一个提示,询问我是否要保存。怎么告诉它我不想保存?
xl = Dispatch('Excel.Application')
xl.Workbooks.Open('New Workbook.xlsx')
# do some stuff
xl.Quit()
from win32com.client import Dispatch
# Start excel application
xl = Dispatch('Excel.Application')
# Open existing excel file
book = xl.Workbooks.Open('workbook.xlsx')
# Some arbitrary excel operations ...
# Close excel application without saving file
book.Close(SaveChanges=False)
xl.Quit()