NamedRange.Text Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the text for the NamedRange control.
public:
property System::Object ^ Text { System::Object ^ get(); };
public object Text { get; }
member this.Text : obj
Public ReadOnly Property Text As Object
Property Value
The text for the NamedRange control.
Examples
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 =
this.Controls.AddNamedRange(this.Range["A1"],
"namedRange1");
namedRange1.Value2 = 223;
namedRange1.Value2 = 1198.3;
namedRange1.NumberFormat = "$#,##0";
// Displays "1198.3".
MessageBox.Show("The Value2 value is: " +
namedRange1.Value2.ToString());
// Displays "$1,198".
MessageBox.Show("The Text value is: " +
namedRange1.Text.ToString());
}
Private Sub DisplayText()
Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
= Me.Controls.AddNamedRange(Me.Range("A1"), _
"namedRange1")
namedRange1.Value2 = 223
namedRange1.Value2 = 1198.3
namedRange1.NumberFormat = "$#,##0"
' Displays "1198.3".
MessageBox.Show("The Value2 value is: " & _
namedRange1.Value2.ToString())
' Displays "$1,198".
MessageBox.Show("The Text value is: " & _
namedRange1.Text.ToString())
End Sub
Remarks
Returns null
for NamedRange controls with multiple cells.