NamedRange.Value Property
Visual Studio 2005
Gets or sets the value of the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)
The Value property can be used with the following optional parameters. If you specify the optional parameters, you must use the set_Value and get_Value accessors in Visual Basic and C#.
| Parameter | Description |
|---|---|
| RangeValueDataType | One of the XlRangeValueDataType values that specifies the data type of the range value. The default is xlRangeValueDefault. |
| _arg1 | The value of the NamedRange control. This parameter is used only with the set_Value set accessor. |
Optional Parameters
For information on optional parameters, see Understanding Optional Parameters in COM Interop.
The following code example demonstrates how to set the Value property with and without the optional parameters.
private void SetValue() { Microsoft.Office.Tools.Excel.NamedRange namedRange1 = this.Controls.AddNamedRange(this.Range["A1", missing], "namedRange1"); namedRange1.Value = "Smith"; Microsoft.Office.Tools.Excel.NamedRange namedRange2 = this.Controls.AddNamedRange(this.Range["A2", missing], "namedRange2"); namedRange2.set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "Jones"); }