How to: Programmatically Close Workbooks
Visual Studio 2012
You can close the active workbook or you can specify a workbook to close.
Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2013 and Excel 2010. For more information, see Features Available by Office Application and Project Type.
There are two procedures for closing the active workbook: one for document-level customizations and one for application-level add-ins.
To close the active workbook in a document-level customization
-
Call the Close method to close the workbook associated with the customization. To use the following code example, run it in the Sheet1 class in a document-level project for Excel.