Partager via


NamedRange.InsertIndent(Int32) Method

Definition

Adds an indent to the NamedRange control.

public:
 void InsertIndent(int InsertAmount);
public void InsertIndent (int InsertAmount);
abstract member InsertIndent : int -> unit
Public Sub InsertIndent (InsertAmount As Integer)

Parameters

InsertAmount
Int32

The amount to be added to the current indent.

Examples

The following code example creates a NamedRange and then uses the InsertIndent method to set an indent level for the NamedRange.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange addIndentRange;
private void AddIndent()
{
    addIndentRange = this.Controls.AddNamedRange(
        this.Range["B4"], "addIndentRange");
    this.addIndentRange.Value2 = "Smith";
    this.addIndentRange.InsertIndent(2);
}
Private addIndentRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub AddIndent()
    addIndentRange = Me.Controls.AddNamedRange( _
        Me.Range("B4"), "addIndentRange")
    Me.addIndentRange.Value2 = "Smith"
    Me.addIndentRange.InsertIndent(2)
End Sub

Remarks

Using this method to set the indent level to a number less than 0 (zero) or greater than 15 causes an exception to be thrown.

Use theIndentLevel property to return the indent level for a range.

Applies to