Shape.AddRows Method

Visio Automation Reference

Adds the specified number of rows to a ShapeSheet section at a specified position.

Version Information
 Version Added:  Visio 4.0

Syntax

expression.AddRows(Section, Row, RowTag, RowCount)

expression   A variable that represents a Shape object.

Parameters

Name Required/Optional Data Type Description
Section Required Integer The section in which to add the rows.
Row Required Integer The position at which to add the rows.
RowTag Required Integer The type of rows to add.
RowCount Required Integer The number of rows to add.

Return Value
Integer

Remarks

If the ShapeSheet section does not exist, the AddRows method creates a section that has blank rows. New cells in new rows are initialized with default formulas, if applicable. Otherwise, a program must include statements to set the formulas for the new cells. An error occurs if the row cannot be added.

The Visio type library declares the constants for RowTag in VisRowIndices.

The row constants declared by the Visio type library serve as base positions at which a section's rows begin. Add offsets to these constants to specify the first row and beyond, for example, visRowFirst+0, visRowFirst+1, and so on. To add rows at the end of a section, pass the constant visRowLast for the Row argument. The value returned is the actual row index.

The RowTag argument specifies the type of rows to add. Pass visTagDefault (0) as the RowTag argument to generate a section's default row type. Explicit tags are useful when adding rows to Geometry, Connection Points, and Controls sections. See the RowType property for descriptions of valid row types for these sections. Passing an invalid row type generates an error.

If you try to add rows to a Character, Tabs, or Paragraph section, an error occurs.

The AddRows method cannot add named rows. To add named rows, use the AddNamedRow method.

If you add rows to a section that has nameable rows (for example, the Connection Points or Controls section), the Row argument is ignored. By default, named rows are named in the order added, for example, Row_1, Row_2, and so forth. Naming order is influenced, however, by any existing rows or previously deleted rows.

See Also