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

Please can somebody help with the code to close all open workbooks without
referring to them by name. I often have to open about 30 workbooks and
closing them down is a waste of time.

Also, I use Excel 2007 but the workbooks are mostly in Excel 2003. I need
all the workbooks saved but without the Check Compatibility checked. Please
help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Code to close many open workbooks

I do not have 2007 here to test my code on but here is something that should
be close..

sub CloseBooks()
dim wbk as workbook

for each wbk in workbooks
wbk.close SaveChanges:=true
next wbk
exit sub

--
HTH...

Jim Thomlinson


"MurrayB" wrote:

Please can somebody help with the code to close all open workbooks without
referring to them by name. I often have to open about 30 workbooks and
closing them down is a waste of time.

Also, I use Excel 2007 but the workbooks are mostly in Excel 2003. I need
all the workbooks saved but without the Check Compatibility checked. Please
help


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Code to close many open workbooks

Hi Jim

I tried the code but it only closes my Personal Macro Workbook. I need to
keep that sheet open but close all my "data" workbooks. Any ideas?

Thanks
Murray


"Jim Thomlinson" wrote in message
...
I do not have 2007 here to test my code on but here is something that
should
be close..

sub CloseBooks()
dim wbk as workbook

for each wbk in workbooks
wbk.close SaveChanges:=true
next wbk
exit sub

--
HTH...

Jim Thomlinson


"MurrayB" wrote:

Please can somebody help with the code to close all open workbooks
without
referring to them by name. I often have to open about 30 workbooks and
closing them down is a waste of time.

Also, I use Excel 2007 but the workbooks are mostly in Excel 2003. I need
all the workbooks saved but without the Check Compatibility checked.
Please
help



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Code to close many open workbooks

On Sep 16, 3:22*pm, "MurrayB" wrote:
Please can somebody help with the code to close all open workbooks without
referring to them by name. I often have to open about 30 workbooks and
closing them down is a waste of time.

Also, I use Excel 2007 but the workbooks are mostly in Excel 2003. I need
all the workbooks saved but without the Check Compatibility checked. Please
help


MurrayB-
The Close All command is still available in Excel 2007 and can be
added to the QAT. It will prompt you to save all workbooks that have
been updated. However, there is no real easy way to avoid the
compatability checker. For workbooks I use frequently, I uncheck the
option so that it doesn't keep popping up on every save. I am unaware
of any global setting. Therefore, it appears it's a one-time uncheck
for each workbook.

Regards,
Excel.Instructor (Ed2Go.com/Advanced Excel)
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Code to close many open workbooks

Sub CLOSE_ALL()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
w.Save
w.Close SaveChanges:=True
Next w
'uncomment line below to automatically leave
'Application.Quit
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"MurrayB" wrote in message
...
Please can somebody help with the code to close all open workbooks without
referring to them by name. I often have to open about 30 workbooks and
closing them down is a waste of time.

Also, I use Excel 2007 but the workbooks are mostly in Excel 2003. I need
all the workbooks saved but without the Check Compatibility checked.
Please help




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Code to close many open workbooks

Hi Don

I tried the code but it only closes my Personal Macro Workbook. I need to
keep that workbook open but close all my "data" workbooks. Any ideas?

Thanks
Murray

"Don Guillett" wrote in message
...
Sub CLOSE_ALL()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
w.Save
w.Close SaveChanges:=True
Next w
'uncomment line below to automatically leave
'Application.Quit
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"MurrayB" wrote in message
...
Please can somebody help with the code to close all open workbooks
without referring to them by name. I often have to open about 30
workbooks and closing them down is a waste of time.

Also, I use Excel 2007 but the workbooks are mostly in Excel 2003. I need
all the workbooks saved but without the Check Compatibility checked.
Please help



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
close all open workbooks except the active one Dav[_4_] Excel Programming 3 April 6th 06 01:26 AM
VBA Code req to close all workbooks Neil Atkinson Excel Programming 2 September 23rd 05 01:46 PM
VBA Code req to close all workbooks Neil Atkinson Excel Programming 0 September 23rd 05 11:06 AM
Open Close workbooks bbc1 Excel Discussion (Misc queries) 2 August 28th 05 11:24 AM
help with macro to open and close workbooks aneurin Excel Programming 1 September 24th 03 02:14 AM


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