Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
close without saving calebjill Excel Discussion (Misc queries) 1 January 29th 09 11:16 PM
File/Close automatically saving changes without prompt Joe@SAA Excel Discussion (Misc queries) 0 June 23rd 08 10:31 PM
close w/o saving jatman Excel Worksheet Functions 5 February 29th 08 02:52 PM
VBA - Close without saving changes PaulW Excel Discussion (Misc queries) 2 July 27th 06 01:22 PM
Close without Saving In VBA Celtic_Avenger[_14_] Excel Programming 3 September 11th 04 11:04 PM


All times are GMT +1. The time now is 03:19 PM.

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

About Us

"It's about Microsoft Excel"