Choose a scenario

Donna Spencer
Donna Spencer used Ask the Experts™
on
I'd like a presentation where the presenter can choose/click a character at the beginning of the presentation and for that character to show during the rest of the presentation on multiple slides. Similar to en eLearning course where you pick a person and that will be the person throughout the course.

I tried placing two characters in the slide master with a trigger to only appear when a button is clicked. However, you are not able to click on the button on the first slide. I am not sure if there is a way to get a trigger to communicate from the main slide to the master. Not sure if macros would help, I have no experience with them.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Consultant and developer
Commented:
Hi Donna,

You can do this with VBA. It's a little tricky but the attached powerpoint demonstrates the idea. You need to run it with macros enabled. I had to save it as an old-fashioned .ppt file rather than .pptm as ExpertsExchange seems not to accept .pptm files right now.

Slide show has two slides currently, but could have as many as you like.

First slide contains two images: Charlie Brown and Snoopy. Plus a button to switch between them.

If you click this button in slideshow mode the code in the PPT will switch the red outline highlight to the other character, and replace all images on other slides that have designated character names with the chosen character.

The designated names are in the list at the top of the code below. Thus in my example, only Charlie Brown and Snoopy are designated characters. Clicking the button does not change the image of Lucy on slide 2. Of course, I had to name the images as well.

Image4.jpg
Here is the code, that is triggered by the button-shape
Sub SelectCharacter()
Dim shp As Shape, shpReplace As Shape, allshapes As Shapes, ooo As Object
Dim sld As Slide, iSlide As Long, iName As Long, iLeft As Long, iTop As Long, iShape As Long
Dim dWidth As Double, dHeight As Double
Dim sNames As String, aNames() As String

'create array of character names
sNames = "Charlie,Snoopy"
aNames = Split(sNames, ",")

'get all shapes on first slide
Set allshapes = ActivePresentation.Slides(1).Shapes
Set shp = allshapes(aNames(iSel))

With shp
'toggle outline of shape
.Line.Visible = Not (.Line.Visible)
.Line.Weight = 4
.Line.ForeColor.RGB = RGB(255, 0, 0)
    'move to next shape if outline turned off
    If .Line.Visible = False Then
    iSel = iSel + 1
    'return to first shape if count of names exceeded
    If iSel > UBound(aNames) Then iSel = 0
    'outline next shape
    SelectCharacter
    Else
    ' if outline turned on (picture chosen)
    shp.Copy
    'cycle through all slides
    For iSlide = 2 To ActivePresentation.Slides.Count
        Set sld = ActivePresentation.Slides(iSlide)
        'run backwards through all shapes on each slide
        For iShape = sld.Shapes.Count To 1 Step -1
        Set shpReplace = sld.Shapes(iShape)
            'if shape has name of character, replace it
            For iName = 0 To UBound(aNames)
                If shpReplace.Name = aNames(iName) Then
                'save position and size
                iLeft = shpReplace.Left
                iTop = shpReplace.Top
                dHeight = shpReplace.Height
                dWidth = shpReplace.Width
                'delete old image
                shpReplace.Delete
                'paste new image
                sld.Shapes.Paste
                'set ShpReplace to newly pasted image (last image on slide)
                Set shpReplace = sld.Shapes(sld.Shapes.Count)
                'adjust position and size of new image and remove outline
                shpReplace.Line.Visible = False
                shpReplace.Left = iLeft
                shpReplace.Top = iTop
                shpReplace.Height = dHeight
                shpReplace.Width = dWidth
                End If
            Next
        Next
    Next
    End If
End With


End Sub

Open in new window


Hope this helps.
character-switch.ppt

Author

Commented:
Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial