Udostępnij za pośrednictwem


Working with Workbooks

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: Create New Workbooks

Open a specified workbook.

How to: Open Workbooks

Close a specified workbook and save changes.

How to: Close Workbooks

Save workbooks in Excel formats or XML format.

How to: Save Workbooks

Bring the focus to the current workbook or a different workbook.

How to: Activate Workbooks

Prevent users from adding or deleting worksheets.

How to: Protect Workbooks

Set a password on a workbook or clear an existing one.

How to: Set and Clear Workbook Passwords

Get and set the default file path for workbooks.

How to: Get and Set the Default File Path for Workbooks

Get a collection of recently used workbook files.

How to: List Recently Used Workbook Files

Display a built-in dialog box for locating files.

How to: Display a Dialog Box to Open Excel Files

Send workbooks as e-mail attachments programmatically.

How to: Send Workbooks by E-Mail Programmatically

Open XML files as workbooks.

How to: Open XML Files as Workbooks

Open text files as workbooks.

How to: 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 application-level add-ins is different from the ways that you perform them in document-level customizations.

See Also

Concepts

Automating Excel by Using Extended Objects

Working with Worksheets

Working with Ranges

Working with Cells

Using Windows Forms Controls on Excel Worksheets