Workbooks.Count If Workbooks.Count > 1 ThenFor i = 1 To Workbooks.Count - 1Workbooks(i).CloseNext iElse Application.Quit End If