Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Dim frm As Form Dim i As Integer ' Зарываем все открытые формы While Forms.Count > 1 For i = 0 To Forms.Count - 1 Set frm = Forms(i) If frm.Name <> "frmMain" Then Unload frm Exit For End If Next Wend If Forms.Count > 1 Then Cancel = TrueEnd Sub