![]() |
close without saving automatically
I recorded a simple macro that opens various files, manipulates them, and
then builds a report. After doing some manipulation of 3 files, I want the macro to close them without saving automatically. When I recorded the macro, it brought up the dialog box "Do you want to save?" when I attempted to close each file. Now when I run the macro, the same dialog boxes come up, which requires my intervention. Is there a simple fix to disable this prompt from coming up and automatically close the files without saving? Below is an example of the recorded VBA. Windows("Modular Sales by Item Pivot.xls").Activate Application.CutCopyMode = False Range("A1").Select ActiveWindow.Close Thanks, Jeff |
close without saving automatically
Put 'application.displayalerts = false' before the close statement and
'application.displayalerts = true' after it. -- Andrew "goofy11" wrote: I recorded a simple macro that opens various files, manipulates them, and then builds a report. After doing some manipulation of 3 files, I want the macro to close them without saving automatically. When I recorded the macro, it brought up the dialog box "Do you want to save?" when I attempted to close each file. Now when I run the macro, the same dialog boxes come up, which requires my intervention. Is there a simple fix to disable this prompt from coming up and automatically close the files without saving? Below is an example of the recorded VBA. Windows("Modular Sales by Item Pivot.xls").Activate Application.CutCopyMode = False Range("A1").Select ActiveWindow.Close Thanks, Jeff |
close without saving automatically
If you don't want to save it:
dim wkbk as workbook set wkbk = workbooks.open(filename:="c:\....\book1.xls") 'do something to wkbk wkbk.close savechanges:=false goofy11 wrote: I recorded a simple macro that opens various files, manipulates them, and then builds a report. After doing some manipulation of 3 files, I want the macro to close them without saving automatically. When I recorded the macro, it brought up the dialog box "Do you want to save?" when I attempted to close each file. Now when I run the macro, the same dialog boxes come up, which requires my intervention. Is there a simple fix to disable this prompt from coming up and automatically close the files without saving? Below is an example of the recorded VBA. Windows("Modular Sales by Item Pivot.xls").Activate Application.CutCopyMode = False Range("A1").Select ActiveWindow.Close Thanks, Jeff -- Dave Peterson |
All times are GMT +1. The time now is 08:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com