Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Closing sheets and selecting 'no' automatically

Hi, I have some code which collects data from various different workbooks on
a network then applied some formating and prints them. When the stuff has
been printed I just simply want to close the workbook without saving the
changes. Now even if i set Application.DisplayAlerts to false while this
part runs can I be sure that the default is not to save them, i.e. the focus
is not on the yes button. Does anyone know anything about this. Thanks for
your time.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Closing sheets and selecting 'no' automatically


Graham Whitehead wrote:
Hi, I have some code which collects data from various different workbooks on
a network then applied some formating and prints them. When the stuff has
been printed I just simply want to close the workbook without saving the
changes. Now even if i set Application.DisplayAlerts to false while this
part runs can I be sure that the default is not to save them, i.e. the focus
is not on the yes button. Does anyone know anything about this. Thanks for
your time.


have look he http://www.vbcity.com/forums/topic.asp?tid=29144
this is way to close without saving

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Closing sheets and selecting 'no' automatically

something equivalent to

Activeworkbook.Close Savechanges:=False

would be the easiest. If it isn't the activeworkbook, substitute a
reference to the workbook you want to close.

--
Regards,
Tom Ogilvy


"Graham Whitehead" wrote:

Hi, I have some code which collects data from various different workbooks on
a network then applied some formating and prints them. When the stuff has
been printed I just simply want to close the workbook without saving the
changes. Now even if i set Application.DisplayAlerts to false while this
part runs can I be sure that the default is not to save them, i.e. the focus
is not on the yes button. Does anyone know anything about this. Thanks for
your time.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Closing sheets and selecting 'no' automatically


Graham Whitehead wrote:
Hi, I have some code which collects data from various different workbooks on
a network then applied some formating and prints them. When the stuff has
been printed I just simply want to close the workbook without saving the
changes. Now even if i set Application.DisplayAlerts to false while this
part runs can I be sure that the default is not to save them, i.e. the focus
is not on the yes button. Does anyone know anything about this. Thanks for
your time


It isn't really a matter of focus on a button, but a matter of
bypassing the 'are you sure?' dialogs.

if you set your alerts to false and your code is programmed to save
your file with a name that already exists, it will overwrite the
existing file - no questions asked

if your alerts are set to false and you close your workbook, it will
not ask if you want to save your changes - no questions asked. (so if
you do, be sure that you have already done so in your code)

hope this helps

AR

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Closing sheets and selecting 'no' automatically

Cheers ducky, just the info I was looking for.

"ducky" wrote in message
ps.com...

Graham Whitehead wrote:
Hi, I have some code which collects data from various different workbooks
on
a network then applied some formating and prints them. When the stuff
has
been printed I just simply want to close the workbook without saving the
changes. Now even if i set Application.DisplayAlerts to false while
this
part runs can I be sure that the default is not to save them, i.e. the
focus
is not on the yes button. Does anyone know anything about this. Thanks
for
your time


It isn't really a matter of focus on a button, but a matter of
bypassing the 'are you sure?' dialogs.

if you set your alerts to false and your code is programmed to save
your file with a name that already exists, it will overwrite the
existing file - no questions asked

if your alerts are set to false and you close your workbook, it will
not ask if you want to save your changes - no questions asked. (so if
you do, be sure that you have already done so in your code)

hope this helps

AR



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
Set macro to run automatically when closing workbook? Wuddus Excel Discussion (Misc queries) 10 January 20th 15 03:39 PM
automatically close form before closing Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 0 September 19th 08 08:26 PM
Automatically closing workbook zapszipszops[_4_] Excel Programming 1 April 19th 06 04:45 PM
closing userform automatically Jim Brass Excel Programming 1 September 5th 05 03:39 PM
Closing Dataform automatically Dkline[_2_] Excel Programming 1 October 9th 03 02:04 AM


All times are GMT +1. The time now is 01:36 AM.

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"