Branching Slides in PowerPoint (VBA)

I was struggling with a similar problem today and made a little "breadcrumb"- generator for powerpoint. There is no link feature yet, but you can implement it if you like: Github Project

Essential parts of the code

 Public Sub breadcrumbs(ByVal count As Integer, ByRef titles() As String)
    Dim cntr As Integer
    Dim content() As String
    Dim margin As Integer
    Dim width As Integer
    '----------------------------

    ' Set Titles
    content = titles
    cntr = 0
    ' Set width
    width = ((Application.ActivePresentation.PageSetup.SlideWidth - (margin * count * 2) - 20) / count) - 50

    ' Loop through all slides
    For Each sld In Application.ActivePresentation.Slides
        ' generate breadcrumb for each title
        For Each con In content
            sld.Shapes.AddShape(1, (50 + (width * cntr)), 15, width, 50).TextFrame.TextRange.Text = con
            cntr = cntr + 1
        Next con
        cntr = 0

    Next sld

End Sub

It sounds like you want a 'breadcrumb trail' of visited slides, instead of a simple back button. Thus you need a way to preserve the trail.

This could be addressed with a dynamic array. New browsing would add records to the array. Your "Next" and "Previous" locations would be found by moving up or down the array. You'll have some mild logic puzzles. I hate to refer you a generic resource, but I'm out of specifics and an overview may be helpful.

UPDATE: I've wanted this in the past for MS Access, and thought I'd readily find a snippet solution. But now I go to search (thinking it will convert over for you easily as well), and I don't find anything. This is surprising because I imagine it would be fun to built. Or ... it's harder to build than I anticipate.


There is a really cumbersome way to do this in PPT directly with no programming. You'll need "forward-facing slides" and 2 sets of "backward-facing slides". Backwards ones are two types - direct-back and home-back. They can all be identical, but make the backward ones hidden (e.g. instead of "Slide 3" you'll need "Slide 3a" and "Slide 3b" and "Slide 3c".). They are hidden so that when you progress through normally, you won't see them, but when you link to them, they will appear. Your link list on the "a" slides should always point to the "b" slides and your "b" slides will point to the "c" slides. Your hyperlinks on "back button" on "a" slides should be "previous slide" and on the "c" slides should be "last slide viewed" and on "h" slides should be "first slide" (use 'action' to set this instead of 'hyperlink').

It takes a while to work through, but it can be done.

Tags:

Vba

Powerpoint