I have used Application.Quit in all my excel applications. However in this application, excel does not close ( the application does close.. I can't use workbook ("name").close, because the name is not static. I am hoping that one of the VBA Gurus' can figure it out. I have tried moving some of the code around, but no luck. Right now I feel dumb, because I can't figure out this simple problem.
Sub OVR_MEETING_1_Close() 'This code does the following tasks. '1. Asks if you want the application closed. '2. Returns the application to the home page (If yes). '3. Does any final calculations & saves (If Yes). '4. Closes both the work book & the application (if yes). Dim MsgBoxResult As Long MsgBoxResult = MsgBox("Would you like to Exit OVR Meeting List?" & vbCr, _ vbYesNo, "Vocational Services - OVR " & ActiveSheet.Name) If MsgBoxResult = vbNo Then Exit Sub ElseIf MsgBoxResult = vbYes Then Dim sGreet As String sGreet = "Good Bye. I enjoyed working with you. Please let me close on my own Thank you!" Application.Speech.Speak sGreet Application.Calculation = xlCalculationAutomatic 'Saves prior to quiting Application. If ThisWorkbook.Saved = False Then ThisWorkbook.Save End If Sheets("TOC").Select Range("F9").Select 'Closes application. ThisWorkbook.Close SaveChanges:=True ThisWorkbook.Saved = True Ok2Close = True End If Application.Quit Application.DisplayAlerts = False End Sub
If I allow the Application.DisplayAlerts then every thing closes.