Share via


ListObjectExtensions.GetVstoObject Method (ListObject, Factory)

Returns a Microsoft.Office.Tools.Excel.ListObject host control that extends the functionality of the current Microsoft.Office.Interop.Excel.ListObject object in a document-level customization. Pass the Globals.Factory object in your project to the factory parameter.

Namespace:  Microsoft.Office.Tools.Excel.Extensions
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function GetVstoObject ( _
    listObject As ListObject, _
    factory As Factory _
) As ListObject
public static ListObject GetVstoObject(
    this ListObject listObject,
    Factory factory
)

Parameters

  • listObject
    Type: Microsoft.Office.Interop.Excel.ListObject

    The native list object to extend. Do not supply this parameter yourself. When you call this method on an Excel list object, the runtime supplies this parameter.

  • factory
    Type: Microsoft.Office.Tools.Excel.Factory

    An object that provides access to certain features in your document-level customization. Pass the Globals.Factory object to this parameter.

Return Value

Type: Microsoft.Office.Tools.Excel.ListObject
A host control that extends the functionality of the current Microsoft.Office.Interop.Excel.ListObject object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ListObject. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

In a document-level customization, you can call this method to get a Microsoft.Office.Tools.Excel.ListObject host control that is in the current customization. If the Microsoft.Office.Interop.Excel.ListObject object on which you call this method is not the underlying object of a Microsoft.Office.Tools.Excel.ListObject host control in the current customization, this method returns nulla null reference (Nothing in Visual Basic).

This method is provided for backward compatibility with Office projects that you retarget from the .NET Framework 3.5 to the .NET Framework 4 or the .NET Framework 4.5. In new projects that target the .NET Framework 4 or the .NET Framework 4.5, you should call the GetVstoObject method that is provided by the Globals.Factory object in your project. For more information, see Programming Document-Level Customizations.

.NET Framework Security

See Also

Reference

ListObjectExtensions Class

GetVstoObject Overload

Microsoft.Office.Tools.Excel.Extensions Namespace

Other Resources

Programming Document-Level Customizations

Extension Methods (C# Programming Guide)

Extension Methods (Visual Basic)