Partager via


NamedRange.Width Property

Definition

Gets the width of the NamedRange control in points.

public:
 property System::Object ^ Width { System::Object ^ get(); };
public object Width { get; }
member this.Width : obj
Public ReadOnly Property Width As Object

Property Value

The width of the NamedRange control in points.

Examples

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

This example is for a document-level customization.

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

Private Sub DisplayHeightAndWidth()
    heightWidthRange = Me.Controls.AddNamedRange( _
        Me.Range("B4"), "heightWidthRange")
    heightWidthRange.Select()
    MessageBox.Show("The NamedRange control is " & _
        Me.heightWidthRange.Width & " points wide and " & _
        Me.heightWidthRange.Height & " points high.")
End Sub

Applies to