Excel2003 VBA - Application.quit not stopping code  
Author Message
AChaves





PostPosted: Visual Basic for Applications (VBA), Excel2003 VBA - Application.quit not stopping code Top

All,

I have a problem with using the application.quit command - as I understand it, the application.quit should immediately jump to the Auto_Close (if exists) and then close any workbooks and quit Excel - however, when I run it, my code continues to run through the end of the sub (see simplified code attached):

Sub test()
Application.Quit
MsgBox ("Test Message 1!")
MsgBox ("Test Message 2!")
MsgBox ("Test Message 3!")
MsgBox ("Test Message 4!")
MsgBox ("Test Message 5!")
MsgBox ("Test Message 6!")
MsgBox ("Test Message 7!")

End Sub

When I run this - I get 7 message boxes, then after the 7th, Excel closes. Any thoughts

Thank you,

Andrew



Microsoft ISV Community Center Forums3  
 
 
ADG





PostPosted: Visual Basic for Applications (VBA), Excel2003 VBA - Application.quit not stopping code Top

Hi

I have had problems with Application.Quit in Office 97, I found that I had to close my sheets with code before I could quit excel. Try directing the flow of your code, simalar to error trapping, so that you do any tidying up then have Application.quit as your last statement.