PowerPoint VBA: Applying Transparency to the Selected Shapes

This PowerPoint VBA macro applies transparency to selected shapes.

Macro Example

Sub TrancparentShapes()

  ActiveWindow.Selection.ShapeRange.Fill.Transparency = 0.5

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.

obj-PowerPoint-Selection-ShapeRange

ShapeRange.Fill

  ActiveWindow.Selection.ShapeRange.Fill...

The ShapeRange.Fill property returns a FillFormat object that contains fill formatting properties for the shapes.

obj-PowerPoint-ShapeRage-Fill

Fill.Transparency (FillFormat.Transparency)

  ActiveWindow.Selection.ShapeRange.Fill.Transparency...

The Fill.Transparency (FillFormat.Transparency property) returns or sets the degree of transparency of the fill as a value between 0.0 (opaque) and 1.0 (clear).

obj-PowerPoint-FillFormat-Transparency

In this macro, I set it to 0.5 .

Sub TrancparentShapes()

  ActiveWindow.Selection.ShapeRange.Fill.Transparency = 0.5

End Sub

Properties

http://www.relief.jp/itnote/archives/powerpoint-macro-setting-shapes-transparency.php

Apply to

  • PowerPoint 2013
  • PowerPoint 2010
  • PowerPoint 2007