Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Value Property
Collapse the table of content
Expand the table of content

NamedRange.Value Property

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)

[BindableAttribute(true)] 
public Object Value { get; set; }

Property Value

The value of the NamedRange control.

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");
}

Show:
© 2015 Microsoft