Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default close all worksheets accept the active one

I've not seen anything on this, but would like to close all opened
worksheets accept the one that is current active - any thoughts on
this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default close all worksheets accept the active one

you mean close all other workBOOKS?
you can't close worksheets............

i would think it would be relatively simple - something like

for each workbook in excel.workbooks
if workbook.active=false then
OR if isnot activeworkbook then
(or something like that)
workbook.close
end if
next workbook

(this is just off the top of my head & syntax is probably terribly
wrong).
hth
susan


On Jan 15, 3:20*pm, S Himmelrich wrote:
I've not seen anything on this, but would like to close all opened
worksheets accept the one that is current active - any thoughts on
this?


  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default close all worksheets accept the active one

One way:

Call the function below like so (use true or false to save each one or not):

Sub Test()
Call FilesDeActivate(False)
End Sub


Public Function FilesDeActivate(argSaveChanges As Boolean)
Dim wrkBooks As Workbooks
Dim wrkBook As Workbook
Set wrkBooks = Application.Workbooks
For Each wrkBook In wrkBooks
If UCase(wrkBook.Name) < UCase(ThisWorkbook.Name) Then
Workbooks(wrkBook.Name).Close SaveChanges:=argSaveChanges
End If
Next wrkBook
End Function


"S Himmelrich" wrote:

I've not seen anything on this, but would like to close all opened
worksheets accept the one that is current active - any thoughts on
this?

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
accept input and move active cell? JR Hester Excel Programming 4 July 28th 06 04:43 PM
how to close active ie browser using a macro [email protected] Excel Programming 2 October 14th 05 06:38 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM


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