WorksheetBase.CustomProperties Property

Gets a Microsoft.Office.Interop.Excel.CustomProperties object representing the identifier information associated with a worksheet.

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

Syntax

'Declaration
Public ReadOnly Property CustomProperties As CustomProperties
public CustomProperties CustomProperties { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.CustomProperties
A Microsoft.Office.Interop.Excel.CustomProperties object representing the identifier information associated with a worksheet.

Examples

The following code example uses the CustomProperties property to add a custom property named "Microsoft" with the value "MSFT" to the current worksheet. The example then iterates through the collection of custom properties until it finds the "Microsoft" property, and sets the value of this property to the cell A1.

This example is for a document-level customization.

Private Sub AddStockSymbol()
        Me.CustomProperties.Add("Microsoft", "MSFT")

        Dim i As Integer 
        For i = 1 To Me.CustomProperties.Count
            If Me.CustomProperties(i).Name = "Microsoft" Then 
                Me.Range("A1").Value2 = _
                    Me.CustomProperties(i).Value.ToString()
                Return 
            End If 
        Next i

    End Sub 'AddStockSymbol
private void AddStockSymbol()
{
    this.CustomProperties.Add("Microsoft", "MSFT");

    for (int i = 1; i <= this.CustomProperties.Count; i++)
    {
        if (this.CustomProperties.get_Item(i).Name == "Microsoft")
        {
            this.Range["A1"].Value2 =
                this.CustomProperties.get_Item(i).Value.ToString();
            return;
        }
    }
}

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace