Sub CATMain () Dim N As Long N = CATIA.Documents.Count If N = 0 Then MsgBox "Es befinden sich keine Dokumente in der Sitzung." Exit Sub End If Dim AllWindows Set AllWindows = CATIA.Windows Dim SelWindow Dim WindowDocument Dim Message Message = "Es sind " & N & " Dokumente geƶffnet" & Chr(10) & "Sollen jetzt alle ohne zu sichern geschlossen werden?" answer = MsgBox(Message, vbYesNo) If answer = vbYes Then For I = N To 2 Step -1 Set SelWindow = AllWindows.Item(I) SelWindow.Activate Set WindowDocument = CATIA.ActiveDocument WindowDocument.Close Next End If End Sub