Compartir a través de


WorksheetBase.CustomProperties Property

Definition

Gets a CustomProperties object representing the identifier information associated with a worksheet.

public:
 property Microsoft::Office::Interop::Excel::CustomProperties ^ CustomProperties { Microsoft::Office::Interop::Excel::CustomProperties ^ get(); };
public Microsoft.Office.Interop.Excel.CustomProperties CustomProperties { get; }
member this.CustomProperties : Microsoft.Office.Interop.Excel.CustomProperties
Public ReadOnly Property CustomProperties As CustomProperties

Property Value

A 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 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;
        }
    }
}
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

Applies to