LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default excel close + save by button press. how?

Try the following procedure.


Sub SaveAllAndQuit()
Dim WB As Workbook
For Each WB In Workbooks
WB.Save
Next WB
Application.Quit
End Sub

Create a new command button and assign this macro to it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"tomro1"
wrote in message
...

i need a code that if you press a button that the excel file
saves
itself and then closes.

thx


--
tomro1
------------------------------------------------------------------------
tomro1's Profile:
http://www.excelforum.com/member.php...o&userid=35081
View this thread:
http://www.excelforum.com/showthread...hreadid=550836



 
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
when press the close button in printpreview x taol Excel Programming 2 June 4th 06 05:41 AM
press button via vb and excel sal21 Excel Programming 0 May 19th 06 01:52 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM
Triggering an Excel macro on press of SAVE darshan Excel Programming 2 December 15th 03 04:57 AM


All times are GMT +1. The time now is 03:03 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"