Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel closing down when I attempt to enter = in one file and then GrahamH Excel Discussion (Misc queries) 3 March 8th 10 11:56 AM
Opening then later Closing an Excel file in VBA Richard Excel Discussion (Misc queries) 1 April 22nd 08 02:07 PM
Error with closing the Excel file ss Excel Discussion (Misc queries) 18 March 17th 08 02:20 PM
Excel Crashes after Inserting New Worksheet and Closing the File ttt Excel Discussion (Misc queries) 4 November 16th 05 01:38 PM
Unexpected error message on closing an Excel file KG Excel Discussion (Misc queries) 1 March 21st 05 02:39 PM


All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"