Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sace and close

I want to have a macro assigned to a button so that when the button is
pressed the current file is saved and then excel is exited.

I tried: -

Sub Closea()
ThisWorkbook.Save
Application.Select.Close
End Sub

But no good. Saving works but not close.

Sub Closea()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub

Will close the workbook but not excel itself.
Any ideas?


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Sace and close

application.quit


Application.Select.Close



arno


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Sace and close

ianripping < wrote:

I want to have a macro assigned to a button so that when the button is
pressed the current file is saved and then excel is exited.

I tried: -

Sub Closea()
ThisWorkbook.Save
Application.Select.Close
End Sub

But no good. Saving works but not close.


To close use Application.Quit

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sace and close

OK Brilliant this works fine, is it possible to make excel save change
to all open workbooks instead of: -

ThisWorkbook.Sav

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Sace and close

Hi
try
For Each w In Workbooks
w.save
Next w

Frank

OK Brilliant this works fine, is it possible to make excel save
changes to all open workbooks instead of: -

ThisWorkbook.Save


---
Message posted from http://www.ExcelForum.com/




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sace and close

Thanks Frank. Works great. Not too sure how it does but it does

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sace and close

Thanks Frank. Works great. Not too sure how it does but it does

--
Message posted from http://www.ExcelForum.com

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
Why excel close all files when I just want to close one files hon123456 Excel Discussion (Misc queries) 2 December 8th 10 12:12 PM
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
close button does not close goplayoutside Excel Discussion (Misc queries) 1 October 11th 05 03:42 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


All times are GMT +1. The time now is 06:29 AM.

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

About Us

"It's about Microsoft Excel"