Back

About MrExcel
Consulting Services
Learn Excel Resources
Challenge of the Month
MrExcel Seminars

Message Board

MrExcel Store
Podcast
Search
Contact
Home

 

 
Kathy asks "I am trying to create a macro for a Button to: exit a worksheet, without saving (it is a Read-only template file), and close Excel...the end users are not comfortable with PC use, so the fewer choices left to them the better...

I'm relatively new at macros and am finding it difficult to locate complete help. Trying to record this resulted in knocking me out of the workbook."

Try this code:

Sub CloseExcel()
ActiveWorkbook.Saved = True
Application.Quit
End Sub

You can change the

ActiveWorkbook.Saved = True

with

ActiveWorkbook.Close SaveChanges:=False

By Juan Pablo Gonzalez on 26-Feb-2002

MrExcel.com Consulting can be hired to implement this concept, or many other cool applications, with your data.

MrExcel.com provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.

 

Excel is a registered trademark of the Microsoft® Corporation.

All contents Copyright 1998-2008 by MrExcel Consulting.