如何用VBA关闭Excel

如果只是关闭当前工作簿,可以用:
ThisWorkBook.Close False

如果要关闭所有工作簿并退出程序,可以试试:
Sub aa()
Application.Quit
If Workbooks.Count > 1 Then
For i = 1 To Workbooks.Count
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{enter}"
Next
Else
SendKeys "{right}"
SendKeys "{enter}"
End If
End Sub

posted @ 2009-11-19 14:29  Nina  阅读(1769)  评论(0编辑  收藏  举报