ContainerProperties.InsertListMember Method (Visio)

Adds a shape or set of shapes to the list in the container.

Version Information

Version Added: Visio 2010

Syntax

expression .InsertListMember(ObjectToInsert, Position)

expression A variable that represents a ContainerProperties object.

Parameters

Name

Required/Optional

Data Type

Description

ObjectToInsert

Required

[UNKNOWN]

The object or selection to insert in the list. Can be a Shape or Selection object.

Position

Required

Long

The insertion point in the list, which is one-based.

Return Value

Nothing

Remarks

If the container is not a list, Microsoft Visio returns an Invalid Source error.

If the ObjectToInsert parameter contains any non-top-level shapes or, if the list is locked, Visio returns an Invalid Parameter error. You cannot insert any of the following objects into a list:

  • Another list.

  • A callout.

  • Routable connectors.

  • Shapes whose PinX or PinY cells have the BOUND, GUARD, or SETATREF function applied.

  • A member of another locked list.

Visio ignores shapes in ObjectToInsert that are already members of the list.

To insert before the first item in the list, pass 1 for the Position parameter. To insert at the end of the list, pass a Position value equal to or greater than the value of the list count plus 1. If you pass an out-of-range position, Visio chooses the nearest valid position.

If ObjectToInsert does not match category requirements for lists, Visio returns an error.

Categories are user-defined strings that you can use to categorize shapes and, thereby, to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating them with semicolons.