NamedRange.Text Property


Gets the text for the NamedRange control.

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

object Text { get; }

Property Value

Type: System.Object

The text for the NamedRange control.

Returns null for NamedRange controls with multiple cells.

The following code example compares how the Text and Value2 properties differ for cells that contain formatted numbers.

This example is for a document-level customization.

private void DisplayText()
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
    namedRange1.Value2 = 223;

    namedRange1.Value2 = 1198.3;
    namedRange1.NumberFormat = "$#,##0";

    // Displays "1198.3".
    MessageBox.Show("The Value2 value is: " +

    // Displays "$1,198".
    MessageBox.Show("The Text value is: " +
Return to top