Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Closing Workbooks

I have two possible requests, which ever is easiest will be the best choice.
:)
A macro I'm working on opens up extra work books for the purpose of pasting
various filtered data (it's fairly complicated, was the only way I could
think to extract the data exactly how I wanted). The end resulting workbook
is the keeper, everything else I want to have close. SO Here is what I've
been playing with:

Windows("Book1").Activate
ActiveWorkbook.Close savechanges:=False
Cells.Select
Selection.Copy
ActiveWindow.Close savechanges:=False
Cells.Select
ActiveSheet.Paste

The only problem with this is that two caution windows pop up. It would be
nice if the macro could just auto answer and I wouldn't have to pay attention
to it.
1: Asking do you want to save the information copied on the clipboard for
pasting later
What does the code look like for it to auto answer yes to that
question?
2: Asks do you want to paste anyway? The data being pasted is a different
size.
What does the code look like for it to auto answer yes to that question?

That would solve everything, leaving a single workbook open. BUT if there
is an easier way, perhaps a formula that will close everything EXCEPT for the
last one (in this case "Book2" ) That just seems like it would be simpler,
but I haven't the foggiest what the code would look like. Any ideas???
THANKS!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Closing Workbooks

Hi Bodhisatvaofboogie,

Try:

Application.EnableAlerts = False

'Your closing code

Application.EnableAlerts = True


---
Regards,
Norman



"bodhisatvaofboogie" wrote in
message ...
I have two possible requests, which ever is easiest will be the best
choice.
:)
A macro I'm working on opens up extra work books for the purpose of
pasting
various filtered data (it's fairly complicated, was the only way I could
think to extract the data exactly how I wanted). The end resulting
workbook
is the keeper, everything else I want to have close. SO Here is what
I've
been playing with:

Windows("Book1").Activate
ActiveWorkbook.Close savechanges:=False
Cells.Select
Selection.Copy
ActiveWindow.Close savechanges:=False
Cells.Select
ActiveSheet.Paste

The only problem with this is that two caution windows pop up. It would
be
nice if the macro could just auto answer and I wouldn't have to pay
attention
to it.
1: Asking do you want to save the information copied on the clipboard for
pasting later
What does the code look like for it to auto answer yes to that
question?
2: Asks do you want to paste anyway? The data being pasted is a
different
size.
What does the code look like for it to auto answer yes to that
question?

That would solve everything, leaving a single workbook open. BUT if there
is an easier way, perhaps a formula that will close everything EXCEPT for
the
last one (in this case "Book2" ) That just seems like it would be
simpler,
but I haven't the foggiest what the code would look like. Any ideas???
THANKS!!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Closing Workbooks

Hi Bodhisatvaofboogie

Application.EnableAlerts = False

'Your closing code

Application.EnableAlerts = True


Should have been

Application.DisplayAlerts = False

'Your closing code

Application.DisplayAlerts = True


---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Closing Workbooks

hi,
to turn alerts off...
Application.displayalerts = false
but afterwards, be sure to turn them back on.....
application.displayalerts = true

regards
FSt1

"bodhisatvaofboogie" wrote:

I have two possible requests, which ever is easiest will be the best choice.
:)
A macro I'm working on opens up extra work books for the purpose of pasting
various filtered data (it's fairly complicated, was the only way I could
think to extract the data exactly how I wanted). The end resulting workbook
is the keeper, everything else I want to have close. SO Here is what I've
been playing with:

Windows("Book1").Activate
ActiveWorkbook.Close savechanges:=False
Cells.Select
Selection.Copy
ActiveWindow.Close savechanges:=False
Cells.Select
ActiveSheet.Paste

The only problem with this is that two caution windows pop up. It would be
nice if the macro could just auto answer and I wouldn't have to pay attention
to it.
1: Asking do you want to save the information copied on the clipboard for
pasting later
What does the code look like for it to auto answer yes to that
question?
2: Asks do you want to paste anyway? The data being pasted is a different
size.
What does the code look like for it to auto answer yes to that question?

That would solve everything, leaving a single workbook open. BUT if there
is an easier way, perhaps a formula that will close everything EXCEPT for the
last one (in this case "Book2" ) That just seems like it would be simpler,
but I haven't the foggiest what the code would look like. Any ideas???
THANKS!!!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Closing Workbooks

Thanks!!! Those both work great!

"bodhisatvaofboogie" wrote:

I have two possible requests, which ever is easiest will be the best choice.
:)
A macro I'm working on opens up extra work books for the purpose of pasting
various filtered data (it's fairly complicated, was the only way I could
think to extract the data exactly how I wanted). The end resulting workbook
is the keeper, everything else I want to have close. SO Here is what I've
been playing with:

Windows("Book1").Activate
ActiveWorkbook.Close savechanges:=False
Cells.Select
Selection.Copy
ActiveWindow.Close savechanges:=False
Cells.Select
ActiveSheet.Paste

The only problem with this is that two caution windows pop up. It would be
nice if the macro could just auto answer and I wouldn't have to pay attention
to it.
1: Asking do you want to save the information copied on the clipboard for
pasting later
What does the code look like for it to auto answer yes to that
question?
2: Asks do you want to paste anyway? The data being pasted is a different
size.
What does the code look like for it to auto answer yes to that question?

That would solve everything, leaving a single workbook open. BUT if there
is an easier way, perhaps a formula that will close everything EXCEPT for the
last one (in this case "Book2" ) That just seems like it would be simpler,
but I haven't the foggiest what the code would look like. Any ideas???
THANKS!!!



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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
closing multi workbooks have_a_cup Excel Discussion (Misc queries) 2 June 28th 06 11:31 PM
Closing Other Workbooks Tim Mayes[_2_] Excel Programming 4 December 13th 04 11:08 PM
Closing workbooks Mischa Browne Excel Programming 4 June 17th 04 04:16 PM
Opening and Closing workbooks Jase Excel Programming 1 October 15th 03 06:28 AM


All times are GMT +1. The time now is 02:17 AM.

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"