Here is a procedure that closes all open workbooks:
Sub CloseAllWorkbooks()
Workbooks.Close
End Sub
Explanation:
The Close() method is called on the Workbooks object. This closes all open workbooks but does not close the Visual Basic Editor (VBE) or Excel Help.
Excel itself remains open after running this procedure.
If a user has made changes to any workbook, they will be prompted to save those changes .
