ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Ah, I think... (https://www.excelbanter.com/excel-programming/271046-ah-i-think.html)

jonas

Ah, I think...
 
Hi,
yes it works much faster although It seems like the whole
application is shutting down and then reopens (which I am
not sure it is actually doing). But anyway it closes the
workbooks much faster compared to the other macro.

Many thanks again!

Jonas

-----Original Message-----
I am not sure. I think that before workbooks are closed,
they are activated, maybe not necesarily maximized. You
could try

Dim wkb As Workbook
Dim OldWinState As Long
Dim OldDispAlerts As Boolean

OldDispAlerts = Application.DisplayAlerts
Application.DisplayAlerts = False
OldWinState = Application.WindowState
Application.WindowState = xlMinimized
For Each wkb In Workbooks
If Not (wkb Is ThisWorkbook) Then
wkb.Close SaveChanges:=False
End If
Next wkb
Application.DisplayAlerts = OldDispAlerts
Application.WindowState = OldWinState

But I am not sure whether that will save you a lot of
time.

.



All times are GMT +1. The time now is 09:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com