Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Macro, or excel program to "Close All' while in a workspace

Hello all,

I usually run a couple of workbooks in one workspace and the only way to
close the workbooks within a workspace is to either:

1) Close each workbook individually

2) Holding the 'shift' key and clicking on 'file' and then clicking on
'close all'.

I have been trying to record a macro to make this easier, but without
any success.

Can someone either let me know if there is another way to close a number
of workbooks within a workspace or help me put together a macro or an
excel program that will alleviate this laborious action?

Cheers

Carlton

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Macro, or excel program to "Close All' while in a workspace

Put this macro in your Personal.xls workbook as a module...
'/=====================================/
Sub CloseEmAll()
Dim wb As Workbook

For Each wb In Workbooks
If UCase(wb.Name) < "PERSONAL.XLS" Then
' Application.DisplayAlerts = False
wb.Close
' Application.DisplayAlerts = True
End If
Next wb

End Sub
'/=====================================/
This will close all open workbooks, hidden or visible with the exception of
the Personal.xls. It will not save the opened workbooks.
To have Excel ask you if you want to save any changed workbooks, uncomment
the 'DisplayAlerts' lines.
HTH,
--
Gary Brown



"Carlton Patterson" wrote:

Hello all,

I usually run a couple of workbooks in one workspace and the only way to
close the workbooks within a workspace is to either:

1) Close each workbook individually

2) Holding the 'shift' key and clicking on 'file' and then clicking on
'close all'.

I have been trying to record a macro to make this easier, but without
any success.

Can someone either let me know if there is another way to close a number
of workbooks within a workspace or help me put together a macro or an
excel program that will alleviate this laborious action?

Cheers

Carlton

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Macro, or excel program to "Close All' while in a workspace

Hi Gary,

Thanks for responding to my request. That is exactly what I needed.

Cheers mate.

Carlton

*** 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
Adding a Close Workspace option when right-clicking Excel in taskb Handsome Prints Setting up and Configuration of Excel 0 September 4th 09 03:34 AM
Excel program close suddenly ST Excel Discussion (Misc queries) 1 February 6th 09 08:31 AM
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
Excel 2003 not responding to "X" to close program Barb Widman - Norwalk City Schools Excel Discussion (Misc queries) 1 May 17th 06 06:37 PM
Macro, or excel program to "Close All' while in a workspace Carlton Patterson Excel Programming 3 May 2nd 05 12:08 AM


All times are GMT +1. The time now is 03:41 PM.

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"