Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Close all inactive workbooks without saving

Hi,

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

Thnx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Close all inactive workbooks without saving

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" a écrit dans le message de
news: ...
Hi,

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

Thnx



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Close all inactive workbooks without saving

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
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 w/o saving jatman Excel Worksheet Functions 5 February 29th 08 02:52 PM
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
Close excel when inactive jennie Excel Programming 3 February 9th 06 08:41 PM
Option in Excel to save a close a workbook inactive for 5 minutes Patricia Peterson Excel Discussion (Misc queries) 4 January 5th 06 05:00 PM
Inactive close Dave Hardy Excel Programming 1 August 12th 03 03:11 PM


All times are GMT +1. The time now is 03:26 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"