Share via


NamedRange.PrefixCharacter Property

Gets the prefix character for the NamedRange control.

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

Syntax

'Declaration
ReadOnly Property PrefixCharacter As Object
    Get
Object PrefixCharacter { get; }

Property Value

Type: System.Object
The prefix character for the NamedRange control.

Remarks

If the value of the TransitionNavigKeys property is false, this prefix character is ' for a text label, or blank. If the value of the TransitionNavigKeys property is true, this character is ' for a left-justified label, " for a right-justified label, ^ for a centered label, \ for a repeated label, or blank.

Examples

The following code example uses the PrefixCharacter property to display the prefix character for a NamedRange.

This example is for a document-level customization.

Private prefixRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub DisplayPrefixCharacter()
    prefixRange = Me.Controls.AddNamedRange( _
        Me.Range("C1"), "prefixRange")
    If CStr(Me.prefixRange.PrefixCharacter) = "" Then
        MessageBox.Show("The prefix character is blank.")
    Else
        MessageBox.Show("The prefix character is: " & _
            Me.prefixRange.PrefixCharacter)
    End If
End Sub
Microsoft.Office.Tools.Excel.NamedRange prefixRange;
private void DisplayPrefixCharacter()
{
    prefixRange = this.Controls.AddNamedRange(
         this.Range["C1", missing], "prefixRange");
    if ((string)this.prefixRange.PrefixCharacter == "")
    {
        MessageBox.Show("The prefix character is blank.");
    }
    else
    {
        MessageBox.Show("The prefix character is: " +
            this.prefixRange.PrefixCharacter);
    }
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace