答案 0 :(得分:3)
你可以这样编码:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'ThisWorkbook Module code!
ActiveWorkbook.Save
'Me.Save is safer - if this workbook is closed programmatically
'then ActiveWorkbook may not be the same one
End Sub
此外:
Workbook.BeforeClose事件(Excel):
http://msdn.microsoft.com/en-us/library/office/ff194765.aspx
答案 1 :(得分:3)
我在Mac上找不到Workbook_BeforeClose函数
呃......那是因为你在看错了地方????您必须在工作簿模块中,而不是工作表模块。
见截图