PowerPoint VBA: Intersecting Shapes

This PowerPoint VBA macro intersect selected shapes.

Macro Example

Sub IntersectShapes()

  ActiveWindow.Selection.ShapeRange.MergeShapes msoMergeIntersect

End Sub

Description

[Application.]ActiveWindow

  ActiveWindow...

The Application.ActiveWindow property returns the DocumentWindow object that represents an active document window.

obj-PowerPoint-Application-ActiveWindow

The ActiveWindow property is a member of the PowerPoint.Global class, so we can omit the Application property.

obj-PowerPoint-Global-ActiveWindow

ActiveWindow.Selection (DocumentWindow.Selection)

  ActiveWindow.Selection...

The ActiveWindow.Selection (DocumentWindow.Selection property) returns the Selection object that represents the selection in the document window.

obj-PowerPoint-DocumentWindow-Selection

Selection.ShapeRange

  ActiveWindow.Selection.ShapeRange...

The Selection.ShapeRange returns a ShapeRange collection object that represents the selected shapes on an active slide.

obj-PowerPoint-Selection-ShapeRange

ShapeRange.MergeShapes

  ActiveWindow.Selection.ShapeRange.MergeShapes...

The ShapeRange.MergeShapes method combines the shapes to create a single new shape.

obj-PowerPoint-ShapeRange-MergeShapes

msoMergeIntersect

By setting the const:msoMergeIntersect to the parameter, the ShapeRange.MergeShapes method creates a new shape from the perimeter of two or more overlapping shapes.

Sub IntersectShapes()

  ActiveWindow.Selection.ShapeRange.MergeShapes msoMergeIntersect

End Sub

Properties

http://www.relief.jp/itnote/archives/powerpoint-vba-merge-shapes.php

Apply to

  • PowerPoint 2013