Worksheet Class (2007 System)
Represents a worksheet that exposes events and acts as a container for controls in Visual Studio Tools for Office projects for Microsoft Office Excel.
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
The class is the base class for worksheet host items in Visual Studio Tools for Office projects. The class provides the same members as the Worksheet class in the Excel primary interop assembly, but it adds the following features:
Controls property. Use this property to add managed controls to an Excel worksheet, or remove controls, at run time.
GetAutomationObject method. Override this method to expose a class in your project to VBA code in the worksheet.
Document-level events, such as ActivateEvent and Change, that are provided only at the application level in the Excel object model. That is, in the Excel object model, these events are defined in the Application class rather than the Worksheet class.
Creating Worksheet Host Items
In application-level projects created by using Visual Studio 2008 Service Pack 1 (SP1), you can create objects programmatically by using the GetVstoObject method of any Worksheet object. For more information, see Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time.
In document-level projects, you cannot create a object programmatically. Instead, use one of the Sheetn classes to programmatically access the worksheet in your project. Visual Studio generates these classes in your project at design time. Each Sheetn class derives from the class, and is instantiated automatically by the Visual Studio Tools for Office runtime when the end user opens the workbook. For more information, see Programming Document-Level Customizations.