Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default closing excel after closing a workbook

Hi all,
I would like to be able to close active workbook (without saving) and
then close Excel completely via a button on a userform.
At present I use the following to close the workbook but this leaves
Excel running.
ActiveWorkbook.Close False
Thanks in advance
chris


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default uit closing excel after closing a workbook

Chris,

Use

Application.Quit

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"CWalsh " wrote in message
...
Hi all,
I would like to be able to close active workbook (without saving) and
then close Excel completely via a button on a userform.
At present I use the following to close the workbook but this leaves
Excel running.
ActiveWorkbook.Close False
Thanks in advance
chris


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default closing excel after closing a workbook

Hi, the following code would do, what you need :

Sub closeAndQuit()

Dim xlAp As Application

Activeworkbook.Saved = True

Set xlAp = ActiveWorkbook.Application

xlAp.Quit

End Sub

In this case, your workbook won't be saved and the Excel applicatio
will quit.

If You wish to save the activeworkbook before closing Excel, you shou
try this instead of "Activeworkbook.Saved = True" :

ActiveWorkbook.Save (if it's saved before)
or
ActiveWorkbook.SaveAs FileName:="Filename.xls"

but remember, if you have more than one Workbooks, it should've bee
done for each one

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default closing excel after closing a workbook

Dear Tolgag
Your answer was great - I have used this and now when I alt-crt-del the
excel process no longer shows as running.
Thank you so much
C


---
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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
Closing a workbook exits Excel Application DarS Excel Discussion (Misc queries) 2 September 27th 07 01:51 PM
Closing only one excel workbook Carollea Excel Discussion (Misc queries) 3 March 28th 07 01:42 PM
EXCEL.EXE has generated an error...when closing a workbook HEIKKILÄT Excel Programming 1 September 17th 03 09:16 PM
Web links in Excel closing workbook steve Excel Programming 4 August 18th 03 08:20 PM


All times are GMT +1. The time now is 05:16 PM.

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"