Share via


Page.DropIntoList Method

Drops the specified object into the specified list at the specified position. Returns the newly dropped shape.

Version Information

Version Added: Visio 2010

Syntax

expression .DropIntoList(ObjectToDrop, TargetList, lPosition)

expression An expression that returns a Page object.

Parameters

Name

Required/Optional

Data Type

Description

ObjectToDrop

Required

IUnknown

The source of the shape to drop into the list. Can be a Master, Selection, Shape, or IDataObject object. See Remarks for more information.

TargetList

Required

Shape

The list into which to drop ObjectToDrop.

lPosition

Required

Long

The position in the 1-based list to add the shape.

Return Value

Shape

Remarks

If ObjectToDrop is a Selection object, the selection can contain only a single shape.

If ObjectToDrop is an IDataObject, it must be associated with a local Microsoft Visio object that is in the same instance as the page on which it is being dropped.

Visio returns an Invalid Target error if ObjectToDrop does not match the category requirements of the list or the container. Shapes can be assigned categories, and containers can have required and excluded categories.

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 the categories with semicolons.

If ObjectToDrop is not a Microsoft Visio object, or if it does not contain top-level shapes on the page, Microsoft Visio returns an Invalid Parameter error.

If the ContainerProperties.LockMembership property of the list is True, Visio returns a Disabled error.

Example

The following Visual Basic for Applications (VBA) example shows how to use the DropIntoList method to add a new shape to an existing list on the active page, in the first position in the list.

Application.ActivePage.DropIntoList vsoMaster, vsoListShape, 1