Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
HI All I'm trying to find a macro to close all open worksheets without saving and exit Excel without prompts. When I run the macro , Excel just closes with no popups of any kind. No worksheets need to be saved. Can someone help? |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
hi Colin,
Am Sun, 17 Nov 2013 14:50:16 +0000 schrieb Colin Hayes: I'm trying to find a macro to close all open worksheets without saving and exit Excel without prompts. try: Sub Test() Dim wbk As Workbook For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close savechanges:=False End If Next With Application .DisplayAlerts = False .Quit .DisplayAlerts = True End With End Sub Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
In article , Claus Busch
writes hi Colin, Am Sun, 17 Nov 2013 14:50:16 +0000 schrieb Colin Hayes: I'm trying to find a macro to close all open worksheets without saving and exit Excel without prompts. try: Sub Test() Dim wbk As Workbook For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close savechanges:=False End If Next With Application .DisplayAlerts = False .Quit .DisplayAlerts = True End With End Sub Regards Claus B. Hi Claus OK thanks for this and again for your help. I find it works fine for worksheets opened after the initial opening sheet (book1), but still give prompts where any change in book1 or it's macros has been made. Worksheets opened and changed after this are close without prompt , which is correct. What do you think? Best Wishes Colin |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
Hi Colin,
Am Sun, 17 Nov 2013 17:15:56 +0000 schrieb Colin Hayes: I find it works fine for worksheets opened after the initial opening sheet (book1), but still give prompts where any change in book1 or it's macros has been made. and you also don't want to save book1? Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
I'm inclined to go with this modified version of Claus' offering...
Sub Test() Dim wkb As Workbook For Each wbk In Workbooks If wkb.Visible And wkb < ThisWorkbook Then _ wkb.Close SaveChanges:=False Next With Application .DisplayAlerts = False: .Quit: .DisplayAlerts = True End With End Sub -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
Typo...
I'm inclined to go with this modified version of Claus' offering... Sub Test() Dim wkb As Workbook For Each wkb In Workbooks If wkb.Visible And wkb < ThisWorkbook Then _ wkb.Close SaveChanges:=False Next With Application .DisplayAlerts = False: .Quit: .DisplayAlerts = True End With End Sub -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com |
#7
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
Hi Colin,
Am Sun, 17 Nov 2013 17:15:56 +0000 schrieb Colin Hayes: I find it works fine for worksheets opened after the initial opening sheet (book1), but still give prompts where any change in book1 or it's macros has been made. then try: Sub Test() Dim wbk As Workbook For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close savechanges:=False End If Next ThisWorkbook.Saved = True Application.Quit End Sub Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#8
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
Hi Garry,
Am Sun, 17 Nov 2013 12:46:49 -0500 schrieb GS: .DisplayAlerts = False: .Quit: .DisplayAlerts = True still you set DisplayAlerts to false with Quit the prompt is shown. Only solution is ThisWorkbook.Saved=True Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#9
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Close all without saving and exit without prompts
In article , Claus Busch
writes Hi Colin, Sub Test() Dim wbk As Workbook For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close savechanges:=False End If Next ThisWorkbook.Saved = True Application.Quit End Sub Regards Claus B. HI Guys OK thanks for this. All working fine now. Everything closes with no saving and no prompts at all. Perfect. ^_^ Best Wishes Colin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
close/open workbook without prompts | Excel Programming | |||
Prompts to Discard digital signature while saving | Excel Programming | |||
Saving Prompts | Excel Worksheet Functions | |||
When saving CSV excel always prompts about the file format | Excel Discussion (Misc queries) | |||
Saving a single Worksheet w/o redundant prompts | Excel Programming |