PC Review


Reply
Thread Tools Rate Thread

Close all inactive workbooks without saving

 
 
Basta1980
Guest
Posts: n/a
 
      2nd Oct 2008
Hi,

Anyone knows how close all inactive workbooks without saving and thus having
just one workbeek (the active)?!

Thnx
 
Reply With Quote
 
 
 
 
papou
Guest
Posts: n/a
 
      2nd Oct 2008
Hello

Dim wWorkb As Workbook
For Each wWorkb In Application.Workbooks
If wWorkb.Name <> ActiveWorkbook.Name Then wWorkb.Close (False)
Next wWorkb

HTH
Cordially
Pascal

"Basta1980" <(E-Mail Removed)> a écrit dans le message de
news: 007621CB-F75A-458A-8E50-(E-Mail Removed)...
> Hi,
>
> Anyone knows how close all inactive workbooks without saving and thus
> having
> just one workbeek (the active)?!
>
> Thnx



 
Reply With Quote
 
jgmiddel
Guest
Posts: n/a
 
      2nd Oct 2008
This should work:

Sub CloseAll()
Dim WkbkName As Object
On Error GoTo Close_Error
For Each WkbkName In Application.Workbooks()
If WkbkName.Name <> ThisWorkbook.Name Then WkbkName.Close
savechanges:=False
Next
Close_Error:
Resume Next
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
close down if inactive Dave Reardon Microsoft Access 2 7th May 2009 05:19 PM
why do all excel worksheets/workbooks close when I close one? =?Utf-8?B?UGVubnk=?= Microsoft Excel Misc 1 29th Nov 2006 03:49 AM
Re: Close inactive database Nikos Yannacopoulos Microsoft Access Forms 0 28th Jun 2004 07:41 AM
Inactive close Dave Hardy Microsoft Excel Programming 1 12th Aug 2003 03:11 PM
Re: Close app after x minutes inactive Allen Browne Microsoft Access 0 19th Jul 2003 03:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:34 PM.