共用方式為


Work with workbooks

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The Workbook and Workbooks class contains the methods and properties you use to perform tasks with workbooks.

Task Procedure
Create a new workbook. How to: Programmatically create new workbooks
Open a specified workbook. How to: Programmatically open workbooks
Close a specified workbook and save changes. How to: Programmatically close workbooks
Save workbooks in Excel formats or XML format. How to: Programmatically save workbooks
Bring the focus to the current workbook or a different workbook.
How to: Programmatically protect workbooks
Get a collection of recently used workbook files. How to: Programmatically list recently used workbook files
Open text files as workbooks. How to: Programmatically open text files as workbooks

For more information about Excel tasks and the Excel object model, see Excel object model overview.

In some cases, the ways that you perform these tasks in VSTO Add-ins is different from the ways that you perform them in document-level customizations.

See also