This documentation is archived and is not being maintained.

NamedRange.Width Property

Gets the width of the NamedRange control in points.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public Object Width { get; }

Property Value

The width of the NamedRange control in points.

The following code example creates a NamedRange and then uses the Width and Height properties to display the width and height of the NamedRange.

Microsoft.Office.Tools.Excel.NamedRange heightWidthRange;
private void DisplayHeightAndWidth()
{
    heightWidthRange = this.Controls.AddNamedRange(
        this.Range["B4", missing], "heightWidthRange");
    heightWidthRange.Select();
    MessageBox.Show("The NamedRange control is " +
    this.heightWidthRange.Width + " points wide and " +
    this.heightWidthRange.Height + " points high.");
}

Show: