Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
why do all excel worksheets/workbooks close when I close one? | Excel Discussion (Misc queries) | |||
accept input and move active cell? | Excel Programming | |||
how to close active ie browser using a macro | Excel Programming | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
excel - Windows close button (x) should only close active workboo. | Setting up and Configuration of Excel |