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)
'Declaration <PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _ Public Class Worksheet _ Inherits EntryPointBindableComponentBase _ Implements ISupportInitializeControl, ISupportInitialize
'Usage Dim instance As Worksheet
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")] public class Worksheet : EntryPointBindableComponentBase, ISupportInitializeControl, ISupportInitialize
[PermissionSetAttribute(SecurityAction::Demand, Name = L"FullTrust")] public ref class Worksheet : public EntryPointBindableComponentBase, ISupportInitializeControl, ISupportInitialize
public class Worksheet extends EntryPointBindableComponentBase implements ISupportInitializeControl, ISupportInitialize
The Microsoft.Office.Tools.Excel.Worksheet class is the base class for worksheet host items in Visual Studio Tools for Office projects. The Microsoft.Office.Tools.Excel.Worksheet 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.
For more information about the role the Microsoft.Office.Tools.Excel.Worksheet class plays in Visual Studio Tools for Office projects, see Host Items and Host Controls Overview and Worksheet Host Item.
Creating Worksheet Host Items
In application-level projects created by using Visual Studio 2008 Service Pack 1 (SP1), you can create Microsoft.Office.Tools.Excel.Worksheet 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 Microsoft.Office.Tools.Excel.Worksheet 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 Microsoft.Office.Tools.Excel.Worksheet 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.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.