Udostępnij za pośrednictwem


Worksheet.CustomProperties Property (2007 System)

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

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property CustomProperties As CustomProperties
'Usage
Dim instance As Worksheet 
Dim value As CustomProperties 

value = instance.CustomProperties
[BrowsableAttribute(false)]
public CustomProperties CustomProperties { get; }
[BrowsableAttribute(false)]
public:
property CustomProperties^ CustomProperties {
    CustomProperties^ get ();
}
public function get CustomProperties () : CustomProperties

Property Value

Type: CustomProperties
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 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", missing].Value2 =
                this.CustomProperties.get_Item(i).Value.ToString();
            return;
        }
    }
}

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace