Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branching Slides in PowerPoint (VBA)

Tags:

powerpoint

vba

I am trying to create a back button but using hyperlinks it simply just takes me to the previous page and ends up in a loop... e.g. if I have slide 1 which has links to slide 3, 4 & 5 then slide 3 links to 6 & 7. If I'm currently on slide 7 and click back it successfully takes me back to slide 3 but then I want to click back and end up at slide 1 rather than back to slide 7 (hopefully I'm making some sense!).

I presume the only way for me to do this is with VBA can anyone give me some advice on best way to create a back button? (I'm using PowerPoint 2007)

like image 769
samcooper11 Avatar asked Sep 02 '09 19:09

samcooper11


People also ask

Can you use VBA in PowerPoint?

PowerPoint VBA provides you with a way to do one of two things using macros and add-ins: Automate PowerPoint: If you ever find yourself repeating the same task over and over again, VBA could be your new best friend. Let's say you have 100 slides and you need to unhide all hidden objects across all those slides.


1 Answers

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
like image 53
Zanidd Avatar answered Nov 06 '22 02:11

Zanidd