ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing Excel Completely (https://www.excelbanter.com/excel-programming/271348-re-closing-excel-completely.html)

Tom Ogilvy

Closing Excel Completely
 
Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
Application.Quit

End Sub

"David W" wrote in message
...
How do I get excel to close all the way out
I got this code to almost to do it but it don't

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub





Tom Ogilvy

Closing Excel Completely
 
Most have seemed to suggest

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.Quit
End Sub

This won't work. the code stops execution after the ActiveWorkbook.Close
(since this is a commandbutton, the workbook with the code will be the
activeworkbook).

John Wilson cleverly suggests you **can** replace Activeworkbook.Close with
Application.Quit - no option here - you must if you want the application to
end.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
Application.Quit

End Sub

"David W" wrote in message
...
How do I get excel to close all the way out
I got this code to almost to do it but it don't

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub







John Wilson

Closing Excel Completely
 
Tom,

John Wilson cleverly suggests you **can** replace Activeworkbook.Close with
Application.Quit - no option here - you must if you want the application to
end.

Knew that.
Obviously didn't state my case very well in my post.

As long as you're on-line, can you give an assist with another post in this
group?
July 9th, recalc question, Bura Tino

Thanks,
John

Tom Ogilvy wrote:

Most have seemed to suggest

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.Quit
End Sub

This won't work. the code stops execution after the ActiveWorkbook.Close
(since this is a commandbutton, the workbook with the code will be the
activeworkbook).

John Wilson cleverly suggests you **can** replace Activeworkbook.Close with
Application.Quit - no option here - you must if you want the application to
end.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
Application.Quit

End Sub

"David W" wrote in message
...
How do I get excel to close all the way out
I got this code to almost to do it but it don't

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub






Tom Ogilvy

Closing Excel Completely
 
Done

Regards,
Tom Ogilvy

"John Wilson" wrote in message
...
Tom,

John Wilson cleverly suggests you **can** replace Activeworkbook.Close

with
Application.Quit - no option here - you must if you want the application

to
end.

Knew that.
Obviously didn't state my case very well in my post.

As long as you're on-line, can you give an assist with another post in

this
group?
July 9th, recalc question, Bura Tino

Thanks,
John

Tom Ogilvy wrote:

Most have seemed to suggest

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.Quit
End Sub

This won't work. the code stops execution after the

ActiveWorkbook.Close
(since this is a commandbutton, the workbook with the code will be the
activeworkbook).

John Wilson cleverly suggests you **can** replace Activeworkbook.Close

with
Application.Quit - no option here - you must if you want the application

to
end.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
Application.Quit

End Sub

"David W" wrote in message
...
How do I get excel to close all the way out
I got this code to almost to do it but it don't

Private Sub CommandButton1_Click()
MsgBox "Please Call In"
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub









All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com