ShapesDeleted event

Microsoft Visio Developer Reference

ShapesDeleted event

       Applies to

Occurs after one or more shapes are deleted from a document.

Version added

4.1

Syntax

You can only handle the ShapesDeleted event by creating an Event object using the Add or AddAdvise method. See those topics for details about the correct syntax.

Remarks

For performance considerations, the Document object's event set does not include the ShapesDeleted event. To sink the ShapesDeleted event from a Document (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Because the ShapesDeleted event is an after event, the deleted shapes are gone when the notification is received. To receive notification just before shapes are deleted, use the BeforeShapeDelete, BeforeSelectionDelete, or BeforeWindowSelDelete event instead.

How you determine which page or master contained the deleted shapes depends on the Action property of the Event object whose target has been triggered.

  • If the event's Action property value is visActCodeRunAddon, then the index of the document and page, or document and master containing the shapes is passed in the command string.
  • If the Action property value is visActCodeAdvise, then the pSubjectObj argument passed to visEventProc is a Selection object whose ContainingShape property is the parent shape of the shapes that got deleted, and the vMoreInfo argument to VisEventProc designates the page or master that contained the deleted shapes.

The EventInfo property of the Application object returns a string that contains additional information about the names of the deleted shapes:

  • If one shape is deleted, the string has the following form:
        /shapes=shapename
    where shapename is the shape's unique ID if it has one; otherwise it is the shape's name ID (sheet.n).
  • If more than one shape is deleted, the string is in the following form, unless the total number of characters in the string exceeds 8,096 characters:
    /shapes=shapename1;shapename2;shapename3;...
  • If a group is deleted, only the group is included in the string. The group's members are not included.
  • If the total number of characters in the string exceeds 8,096 characters, it has the following form:
    /shapes=many