Button to change the slide's section during slideshow, PowerPoint 2010
March 23, 2013 12:48 PM   Subscribe

I have a slideshow with 4 sections named "CurrentSection", "NextSection", "AfterNextSection", and "AfterAfterNextSection". The slideshow is viewed repeatedly but also irregularly (sometimes multiple times per week and sometimes weeks in-between). After each slide is viewed and discussed, I need to be able to assign the slide to a different section. (A slide's section determines how soon it will be viewed again, as explained below.)

Here's what I'm trying to be able to do:

Begin the slideshow but show only slides that are in CurrentSection. (I think I know how to do this)

(This is where I need the help) I'd like to have three buttons on each slide so that, after a slide is viewed and discussed, one of the buttons can be pressed which will remove the slide from CurrentSection and put it into either NextSection, AfterNextSection, or AfterAfterNextSection, depending on which button is pressed.

When no more slides remain in CurrentSection I want to automatically
a.) end slideshow
b.) delete CurrentSection (will be empty at that point)
c.) rename NextSection to CurrentSection
d.) rename AfterNextSection to NextSection
e.) rename AfterAfterNextSection to AfterNextSection
f.) recreate AfterAfterNextSection (will be empty)

So then the slideshow is ready to restart when desired (once again showing only slides in CurrentSection)

Can anyone tell if this can be done or how to do it? Thanks.
posted by atm to Computers & Internet (7 answers total)
 
If this is possible to do then you would accomplish it via Powerpoint scripting.
posted by mmascolino at 2:51 PM on March 23, 2013


How are you with VBA? Here's a VBA script that has some elements of what you want to do.
posted by SuperSquirrel at 2:57 PM on March 23, 2013


I wish I could edit my question because I see that I forgot to mention that I am looking for VBA help (rather than programmable macro help). I do want to vba code behind the buttons, and and semi-decent with vba.

I have seen and played with the page/code you mention, SuperSquirrel. It doesn't seem to instruct in how to do what I am trying though.
posted by atm at 4:18 PM on March 23, 2013


Here you go. Not sure how you have it set up to play only the slides in CurrentSection, so you may have to tweak this.

Your presentation has to be saved as macro-enabled (pptm).

Put three command buttons on your slide, named cmdNext, cmdAfterNext and cmdAfterAfterNext. I don't have it set up to use a group box or another control so you don't have to duplicate the buttons. You may be able to figure that part out, and it would make the code cleaner. As it is, you have to put the following in each slide's code:


Option Explicit

Private Sub cmdAfterAfterNext_Click()
MoveSlideToSection Me, 4
End Sub

Private Sub cmdAfterNext_Click()
MoveSlideToSection Me, 3
End Sub

Private Sub cmdNext_Click()
MoveSlideToSection Me, 2
End Sub


Then create a module and put this in it:

Option Explicit

Public Sub MoveSlideToSection(theSlide As Slide, newSectionIndex As Integer)
Dim originalSlideIndex As Integer
Dim i, lastSlideIndex, firstSlideIndex As Integer
Dim originalSectionOver As Boolean

originalSlideIndex = theSlide.SlideIndex
If originalSlideIndex = ActivePresentation.SectionProperties.SlidesCount(1) Then
originalSectionOver = True
End If

theSlide.MoveToSectionStart newSectionIndex

'Reorder the new section because the new slide is put at the beginning
With ActivePresentation
firstSlideIndex = .SectionProperties.FirstSlide(newSectionIndex)
lastSlideIndex = firstSlideIndex + .SectionProperties.SlidesCount(newSectionIndex) - 1
For i = firstSlideIndex + 1 To lastSlideIndex
.Slides(lastSlideIndex).MoveToSectionStart newSectionIndex
Next i
End With

'check if there are more slides in the original section
With ActivePresentation
If originalSectionOver Then
.SlideShowWindow.View.Exit
Else
.SlideShowWindow.View.GotoSlide originalSlideIndex
End If
End With

RenameSections

End Sub

Private Sub RenameSections()
Dim sectionIndex As Integer

With ActivePresentation.SectionProperties
For sectionIndex = 1 To 3
.Move sectionIndex + 1, sectionIndex
Next sectionIndex
End With

With ActivePresentation.SectionProperties
.Rename 1, "CurrentSection"
.Rename 2, "Next"
.Rename 3, "AfterNext"
.Rename 4, "AfterAfterNext"
End With
End Sub


That should do it. This assumes you don't add any sections or change their names.
posted by SuperSquirrel at 12:29 PM on March 24, 2013


Thanks a lot, SuperSquirrel. I've tried it and it doesn't seem to work as expected. I created a pptm with 4 sections and 4 slides in CurrentSection (I put a text box on each slide containing a number 1-4 so I could track each slide as it moves from section to section). I wanted to write and tell exactly what happens when I press abc buttons on xyz slides, but it seems to vary from run to run. Did you test it much? Did it work for you?
posted by atm at 5:43 PM on March 24, 2013


I didn't test every possible combination of slides and sections, no. You'll have to tweak it.

If you want to send me the presentation you're working with, I can take a look at it. Email is in my profile.
posted by SuperSquirrel at 6:14 PM on March 24, 2013


I think I figured out what was happening. The only problem was that "RenameSections" needed to be placed just above the line ".SlideShowWindow.View.Exit". Everything seems to be working well now.

Thanks very much, SuperSquirrel!
posted by atm at 8:20 PM on March 24, 2013


« Older Living with transplanted organs and...   |   I have a question about animal containment, or... Newer »
This thread is closed to new comments.