Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 VSTO Add-in projects for Excel. 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 VSTO Add-ins.
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.
Call the Close method to close the active workbook. To use the following code example, run it in the ThisAddIn
class in a VSTO Add-in project for Excel.
The way that you close a workbook that you specify by name is the same for VSTO Add-ins and document-level customizations.
Specify the workbook name as an argument to the Workbooks collection. The following code example assumes that a workbook named NewWorkbook is open in Excel.
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!