ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing file and excel (https://www.excelbanter.com/excel-programming/312507-closing-file-excel.html)

Jean-Paul De Winter

Closing file and excel
 
Hi,
I created a pushbutton with following code:

Private Sub CommandButton4_Click()
ActiveWorkbook.Close
End Sub

When I click I am asked if I want to save the workbook....
Tha idea is, when clicking the button, ALWAYS save the wrokbook and close
excel.

What code should I add?

Thanks



Frank Kabel

Closing file and excel
 
Hi
try
Private Sub CommandButton4_Click()
activeworkbook.save
application.quit
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Jean-Paul De Winter" schrieb im Newsbeitrag
...
Hi,
I created a pushbutton with following code:

Private Sub CommandButton4_Click()
ActiveWorkbook.Close
End Sub

When I click I am asked if I want to save the workbook....
Tha idea is, when clicking the button, ALWAYS save the wrokbook and

close
excel.

What code should I add?

Thanks




Jean-Paul De Winter

Closing file and excel
 
great... just what I wanted
Thanks
JP
"Frank Kabel" schreef in bericht
...
Hi
try
Private Sub CommandButton4_Click()
activeworkbook.save
application.quit
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Jean-Paul De Winter" schrieb im Newsbeitrag
...
Hi,
I created a pushbutton with following code:

Private Sub CommandButton4_Click()
ActiveWorkbook.Close
End Sub

When I click I am asked if I want to save the workbook....
Tha idea is, when clicking the button, ALWAYS save the wrokbook and

close
excel.

What code should I add?

Thanks







All times are GMT +1. The time now is 08:39 AM.

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