View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
MurrayB MurrayB is offline
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