Item Method

Microsoft PowerPoint Visual Basic

Show All

Item Method

       

Item method as it applies to the ActionSettings object.

Returns a single action setting from the specified ActionSettings collection.

expression.Item(Index)

expression   Required. An expression that returns an ActionSettings collection.

Index  Required PpMouseActivation. The action setting for a MouseClick or MouseOver event.

PpMouseActivation can be one of these PpMouseActivation constants.
ppMouseClick The action setting for when the user clicks the shape.
ppMouseOver The action setting for when the mouse pointer is positioned over the specified shape.

Item method as it applies to the AddIns, CanvasShapes, Designs, DiagramNodeChildren, DiagramNodes, Fonts, GroupShapes, NamedSlideShows, Presentations, ShapeNodes, ShapeRange, Shapes, SlideRange, and Slides objects.

Returns a single object from the specified collection.

expression.Item(Index)

expression   Required. An expression that returns one of the above objects.

Index  Required Variant. The name or index number of the single object in the collection to be returned.

Item method as it applies to the AnimationBehaviors, AnimationPoints, CellRange, ColorSchemes, Columns, Comments, DocumentWindows, ExtraColors, Hyperlinks, ObjectVerbs, Panes, Placeholders, PrintRanges, PublishObjects, Rows, RulerLevels, Sequence, Sequences, SlideShowWindows, TabStops, and TextStyleLevels objects.

Returns a single object from the specified collection.

expression.Item(Index)

expression   Required. An expression that returns an AnimationBehaviors collection.

Index  Required Long. The index number of the single object in the collection to be returned.

Item method as it applies to the Borders object.

Returns a LineFormat object for the specified border.

expression.Item(BorderType)

expression   Required. An expression that returns a Borders collection.

BorderType  Required PpBorderType. Specifies which border of a cell or cell range is to be returned.

PpBorderType can be one of these PpBorderType constants.
ppBorderBottom
ppBorderDiagonalDown
ppBorderDiagonalUp
ppBorderLeft
ppBorderRight
ppBorderTop

Item method as it applies to the Tags object.

Returns a single tag from the specified Tags collection.

expression.Item(Name)

expression   Required. An expression that returns a Tags object.

Name  Required String. The name of the single tag in the collection to be returned.

Item method as it applies to the TextStyles object.

Returns a single text style from the specified TextStyles collection.

expression.Item(Type)

expression   Required. An expression that returns a TextStyles collection.

Type  Required PpTextStyleType. The text style type.

PpTextStyleType can be one of these PpTextStyleType constants.
ppBodyStyle
ppDefaultStyle
ppTitleStyle

Remarks

The Item method is the default member for a collection. For example, the following two lines of code are equivalent:

ActivePresentation.Slides.Item(1)
ActivePresentation.Slides(1)

For more information about returning a single member of a collection, see Returning an Object from a Collection.

Example

As it applies to the ActionSettings object.

This example sets shape three on slide one to play the sound of applause and uses the AnimateAction property to specify that the shape's color is to be momentarily inverted when the shape is clicked during a slide show.

With ActivePresentation.Slides.Item(1).Shapes _
        .Item(3).ActionSettings.Item(ppMouseClick)
    .SoundEffect.Name = "applause"
    .AnimateAction = True
End With

As it applies to the RulerLevels object. 

This example sets the first-line indent and the hanging indent for outline level one in body text on the slide master for the active presentation.

With ActivePresentation.SlideMaster.TextStyles.Item(ppBodyStyle)
    With .Ruler.Levels.Item(1) ' sets indents for level 1
        .FirstMargin = 9
        .LeftMargin = 54
    End With
End With

As it applies to the Shapes object. 

This example sets the foreground color to red for the shape named "Rectangle 1" on slide one in the active presentation.

ActivePresentation.Slides.Item(1).Shapes.Item("rectangle 1").Fill _
    .ForeColor.RGB = RGB(128, 0, 0)

As it applies to the Tags object. 

This example hides all slides in the active presentation that don't have the value "east" for the "region" tag.

For Each s In ActivePresentation.Slides
    If s.Tags.Item("region") <> "east" Then
        s.SlideShowTransition.Hidden = True
    End If
Next