View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Ah, I think...

Since there is nothing in the macro that specifically maximizes the
workbook, this must be an inherent action of the close method. You can
avoid seeing it and perhaps this will speed up your macro

Dim wkb As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
For Each wkb In Workbooks
If Not wkb.Name = ThisWorkbook.Name Then
wkb.Close SaveChanges:=False
End If
Next wkb
Application.ScreenUpdating = True
Application.DisplayAlerts = True

Also shows how you can use the Name - no danger of duplicates - you can't
have a duplicate name. Also, needs no adjustment if you rename the
workbook. Not sure what Arne was thinking of.

Regards,
Tom Ogilvy


"jonas" wrote in message
...
Hi
yes that solution I know of but it is not applicable for
me right now since I have 7500 files to process and they
are all named differently.

Another thing I thought of is if it would be possible to
close all open but minimised workbooks without maximase
them? Right now I have 17 open workbooks which are all
minimised and with changes which I would like to close
without saving any changes. The macro you sent me works
fine but it maximise every workbook before closing it
which takes some time. Closing without saving changes and
without maximising the windows would probably go faster.
Do you know if there is such a solution?

Kind regards
Jonas
-----Original Message-----
By the way, as always there are several possible

solutions
o the problem. Instead of comparing the objects wkb and
ThisWorkbook (using the 'Is' operator), you could also
consider comparing wkb.Name with the name of your
workbook. However, in that case, you have to alter your
macro whenever you change the name of your workbook.


.