Excel Dateien ohne weitere Nachfrage schließen

Zur Navigation springen Zur Suche springen

Alle geöffneten Excel-Dateien ohne weitere Nachfrage und ohne Speichern schließen.

Die aufrufende Exceldatei bleibt geöffnet.
Public Sub CloseAll()
   Dim Wb As Workbook, myName As String
   
   myName = LCase(ThisWorkbook.Name)
   
   ' close all Excel files regardless of temporary or not
   ' without asking for saving
   For Each Wb In Application.Workbooks
     If LCase(Wb.Name) <> myName Then Wb.Close False
   Next Wb
 
End Sub