Shape.AddRow Method
Visio Automation Reference |
Adds a row to a ShapeSheet section at a specified position.
Version Information
Version Added: Visio 2.0
Syntax
expression.AddRow(Section, Row, RowTag)
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 row. |
Row | Required | Integer | The position at which to add the row. |
RowTag | Required | Integer | The type of row to add. |
Return Value
Integer
Remarks
If the ShapeSheet section does not already exist, it is created with a blank row. 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. If the new row cannot be added, an error is generated.
The Visio type library declares row constants prefixed with visRow in VisRowIndices.
Constants for rows in the Geometry, Connection Points, and Controls sections are prefixed with visTag and declared by the type library in VisRowTags. To see a list of these constants, see the RowType property.
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 row to add. To generate a section's default row type, pass visTagDefault (0) as the RowTag argument. 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 a row to a Character, Tabs, or Paragraph section, an error occurs.
The AddRow 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.
Example
The following example shows how to add a section to a ShapeSheet and how to add a row to the section at a specified position.
Visual Basic for Applications |
---|
|
See Also