Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default VBA Code req to close all workbooks

Many Thanks I had forgot how simple that is...

Rgds
Neil

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA Code req to close all workbooks

You might also want to test for Personal.xls, you probably don't want to
close that.

--
HTH

Bob Phillips

"Neil Atkinson" wrote in message
...
Many Thanks I had forgot how simple that is...

Rgds
Neil

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default VBA Code req to close all workbooks

Hi Bob,

A good suggestion.


Neil,

Should you wish to keep your Peronal.xls workbook open, as per Bob's
suggestion, then try this amendment:

'====================
Sub Workbook_Open()
Dim WB As Workbook

For Each WB In Application.Workbooks
If WB.Name < ThisWorkbook.Name _
And LCase(WB.Name) < "personal.xls" Then
WB.Close SaveChanges:=True
End If
Next WB

End Sub
'<<====================

---
Regards,
Norman



"Bob Phillips" wrote in message
...
You might also want to test for Personal.xls, you probably don't want to
close that.

--
HTH

Bob Phillips

"Neil Atkinson" wrote in message
...
Many Thanks I had forgot how simple that is...

Rgds
Neil

*** Sent via Developersdex http://www.developersdex.com ***





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
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
VBA Code req to close all workbooks Neil Atkinson Excel Programming 0 September 23rd 05 11:06 AM
Why does Excel close all workbooks? JVernon Setting up and Configuration of Excel 1 July 5th 05 10:38 PM
Close all other workbooks but this one? ianripping[_93_] Excel Programming 3 September 2nd 04 10:30 AM
So close yet so far - combining workbooks happy Excel Programming 17 May 20th 04 04:05 AM


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

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"