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

Try this code

Sub CloseWorkbooks()

Dim WB As Workbook

For Each WB In Application.Workbooks
If WB.Name < "A.xls" Then
If WB.Name = "D.xls" Then
WB.Close SaveChanges:=True
Else
WB.Close SaveChanges:=False
End If
End If
Next WB


End Sub



ChrisP wrote:
Thanks! One more question, workbooks B & C I don't want to save but D I do.
How would I write that?

Thanks again!
Chris

Hi Chris

[quoted text clipped - 27 lines]
Thanks,
Chris


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200808/1

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
Workbooks.Close andim Excel Programming 5 June 20th 08 06:18 PM
workbooks close before OlieH Excel Programming 1 April 6th 08 08:40 AM
How to close All Workbooks Mervyn Thomas Excel Programming 1 December 28th 07 09:22 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 all other workbooks Rob Excel Programming 5 February 5th 06 08:44 PM


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