Share via

How do I identify slides?

Anonymous
2015-04-09T03:30:08+00:00

I know they have numbers but understand that this is not reliable if slides are reorganized.  I hear that they

should be named but do not see how.  I would like to use code to direct the user to specific slides depending

on the answer to multiple choice questions.

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2015-04-09T15:27:55+00:00

    As JohnW suggests, SlideID is one way.   You can also use "tags" to identify slides.

    Example:

    With ActivePresentation.Slides(1)

       .Tags.Add "SlideName", "Slide One"  

    End With

    The tag value can be any string and you can add pretty much as many tags to each slide (or each shape on the slide, or each presentation) as you like.

    Then you can use a function to retrieve the slide you're after:

    Function SlideTaggedWith(sTagName as String, sTagValue as String) as Slide

       Dim oSl as Slide

       For Each oSl in ActivePresentation.Slides

          If oSl.Tags(sTagName) = sTagValue Then ' found ii!

              Set SlideTaggedWith = oSl

              Exit Function

          End If

       Next

    End Function

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-04-09T15:22:33+00:00

    To someone with a moderate amount of experience with VBA, John's answer is all that's needed.

    To someone with less experience, more detail would be necessary but it's tough to evaluate a person's skill level from a simple question here.  

    So we're faced with a decision:  

    Write a book-length answer that covers everything a VBA novice would need to accomplish the goal (knowing that the person who's asked the question may never even return to read the answer), or provide the basics and wait to see if they ask for more information as a followup question.  

    So did you need to know more about using SlideID?  

    Depending on your PPT version, it may be enough to type SlideID into a bit of code in the VBA editor and press F1 for Help.  Or type SlideID into the search text box at upper right of the VBA editor.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-04-09T14:10:24+00:00

    Here's VBA I use to set slide namess and a second utility to get the existing names.

    Sub SetSlideName()

      Dim SlideName$

      On Error GoTo AbortNameSlide

      If ActiveWindow.Selection.SlideRange.Count = 0 Then

        MsgBox "No Slides Selected"

        Exit Sub

      End If

      SlideName$ = ActiveWindow.Selection.SlideRange(1).Name

      SlideName$ = InputBox$("Give this slide a name", "Slide Name", SlideName$)

      If SlideName$ <> "" Then

        ActiveWindow.Selection.SlideRange(1).Name = SlideName$

      End If

      Exit Sub

    AbortNameSlide:

      MsgBox Err.Description

    End Sub

    Sub GetSlideName()

      Dim SlideName$

      SlideName$ = ActiveWindow.Selection.SlideRange(1).Name

      MsgBox SlideName$

    End Sub

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-04-09T11:32:44+00:00

    Use the SlideID which is usually unchanged by moving slides and the FindBySlideID method.

    Wow, is it my imagination or are answers here geared to only the least amount of information possible? This thread caught my eye and I see that there is no indication in how to find or use this "slideID".....

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2015-04-09T07:28:19+00:00

    Use the SlideID which is usually unchanged by moving slides and the FindBySlideID method.

    Was this answer helpful?

    0 comments No comments