Class Guide (PowerPoint VBA)

The class Guide represents a drawing guide in the presentation or custom layout.

Set

To use a Guide class variable it first needs to be instantiated, for example

Dim gui as Guide
Set gui = ActivePresentation.SlideMaster.CustomLayouts(1).Guides(Index:=1)

The following procedures can be used to set variables of type Guide: Guides.Item, Guides.Add, CustomLayout.Guides, Master.Guides and Presentation.Guides

Color

Returns a ColorFormat object that represents the color of the drawing guide.

Dim cftColor As ColorFormat
Set cftColor = ActivePresentation.SlideMaster.CustomLayouts(1).Guides(1).Color

Delete

Removes the drawing guide from the presentation or custom layout.

ActivePresentation.SlideMaster.CustomLayouts(1).Guides(1).Delete

Orientation

Returns the orientation of the drawing guide (horizontal or vertical) as a constant from the PpGuideOrientation enumeration.

Possible Values are ppHorizontalGuide - Represents a horizontal guide, spanning from the left to right of the slide editing window, ppVerticalGuide - Represents a vertical guide, spanning from top edge to bottom of the slide editing window.
Dim pgoOrientation As PpGuideOrientation
pgoOrientation = ActivePresentation.SlideMaster.CustomLayouts(1).Guides(1).Orientation

Parent

Returns the parent for the specified object. Read-only object.

Position

Returns or sets a Single that represents the position of the drawing guide along the x- or y-axis.

ActivePresentation.SlideMaster.CustomLayouts(1).Guides(1).Position =

Guides.Add

Adds a new drawing guide to the presentation, slide master, or custom layout.

Syntax : expression.Add (Orientation, Position)

Dim gui As Guide
Set gui = ActivePresentation.SlideMaster.CustomLayouts(1).Guides.Add(Orientation:=ppHorizontalGuide, Position:=)

Arguments

The following arguments are required:

Orientation (PpGuideOrientation) - Specifies the orientation of a drawing guide, either horizontal or vertical.

Possible Values are ppHorizontalGuide - Represents a horizontal guide, spanning from the left to right of the slide editing window, ppVerticalGuide - Represents a vertical guide, spanning from top edge to bottom of the slide editing window.

Position (Single) - The position of the guide along the specified axis.

Guides.Count

Returns the number of objects in the specified collection.

Dim lngCount As Long
lngCount = ActivePresentation.SlideMaster.CustomLayouts(1).Guides.Count

Guides.Item

Returns a Guide object from the collection.

Syntax : expression.Item (Index)

Index: The index number of the single Guide object in the collection to be returned.

Dim gui As Guide
Set gui = ActivePresentation.SlideMaster.CustomLayouts(1).Guides(Index:=1)

Guides.Parent

Returns the parent for the specified object. Read-only object.