Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to manipulate PowerPoint

Status
Not open for further replies.

jagdriver

Programmer
Apr 13, 2004
11
US
I have three FAQ buttons on a PPT slide 1, each adjacent to 1 of 3 separate paragraphs.
Clicking the [FAQ1] button should take the user to PPT slide 20, where the FAQ1 text is displayed (Wipe Left). FAQ2 text and FAQ3 text, also on slide 20, should be hidden at this point.
Clicking the [FAQ2] button should take the user to the same PPT slide 20, where the FAQ2 text is now displayed (Wipe Left). FAQ1 text and FAQ3 text are hidden.
Clicking the [FAQ3] button should again take the user to the same PPT slide 20, where the FAQ3 text is displayed. FAQ1 text and FAQ2 text are hidden.
Can you provide some sample code to help me get started?
Thanks!
 
jagdriver,

Have you recorded a macro yet? If not, turn on the macro recorder and do your thing.

Then check you code and post back WITH your code and specific questions.

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
That's just it, Skip. I've tried repeatedly to record variants of the macro, but I'm not making progress. I'll give it another try, though.
 
Have you recorded ANYTHING?

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
As follows (more after code sample):

Code:
Sub Macro1()
'
' Macro recorded 4/13/2004 by CHMOR
'

    With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
        .Run = "Macro1"
        .Action = ppActionRunMacro
        ' .SoundEffect.Type = ppSoundNone
        ' .AnimateAction = msoFalse
    End With
    ' With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseOver)
    '    .Action = ppActionNone
    '    .SoundEffect.Type = ppSoundNone
    '    .AnimateAction = msoFalse
    ' End With
    ' With ActivePresentation.SlideShowSettings
    '    .ShowType = ppShowTypeSpeaker
    '    .LoopUntilStopped = msoFalse
    '   .ShowWithNarration = msoTrue
    '    .ShowWithAnimation = msoTrue
    '    .RangeType = ppShowAll
    '    .AdvanceMode = ppSlideShowUseSlideTimings
    '    .PointerColor.SchemeColor = ppForeground
    '    .Run
    ' End With
    SlideShowWindows(Index:=1).View.GotoSlide Index:=4
    ' SlideShowWindows(Index:=1).View.Exit
    ActiveWindow.Selection.SlideRange.Shapes("Rectangle 13").Select
End Sub

As you can see, I've REM'd out lines that I believe are superfluous in this context. In its present state the macro does not function at all... clicking the [FAQ] button doesn't do a darn thing.
 
OK,

On slide 1 you have 3 buttons. Are they Control Toolbox CommandButtons? If so in the Slide1 Object
Code:
Private Sub CommandButton1_Click()
    SelectSlide 20
End Sub
Then in a Module
Code:
Sub SelectSlide(n)
 SlideShowWindows(Index:=1).View.GotoSlide Index:=n
End Sub
selects the desired slide.

After hitting button1 and viewing the FAQ, how does one get back to Slide?


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
No, these are buttons I drew in PPT using AutoShapes > ActionButtons. I'm then doing an ActionSettings > RunMacron from the context-sensitive menu when I right-click the button in edit mode.
The FAQ slide has a [BACK] button that, when clicked, is supposed to hide the FAQn text and return the user to the originally-viewed slide.
 
I am having a similar problem. Can't get an Action Button to run mu macro???

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
That's not the issue if the text on the button is not grouped with the button itself. I have instructed PPT to only run the macro when the button itself is clicked. So the following code works, as does the [Back] button which is hyperlinked to "Last Slide Viewed". The problem now is how to only display one para at a time--with the other paras hidden--on the FAQ page when the corresponding [FAQ] button is clicked:

Code:
Sub Macro3()
'
' Macro recorded 4/13/2004 by CHMOR
'

    SlideShowWindows(Index:=1).View.GotoSlide Index:=4
    ActiveWindow.Selection.SlideRange.Shapes("Rectangle 5").Select
End Sub
 
Ahhhh.
Code:
Sub FAQ_Text(n)
    For Each sh In ActiveWindow.Shapes
        sh.Color.SchemeColor = ppBackground
    Next
    With ActiveWindow.Shapes(n)
        .Color.SchemeColor = ppForeground
    End With
End Sub
where shape(1) is the textbox with FAQ1 etc.

Button 1 calls FAQ_Text(1) etc

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Sorry Skip, but I'm not tracking. Now when I click the FAQ1 button on slide 1, nothing happens.

Code:
Sub Macro3()
    SlideShowWindows(Index:=1).View.GotoSlide Index:=4
    For Each sh In ActiveWindow.Shapes
        sh.Color.SchemeColor = ppBackground
    Next
    With ActiveWindow.Shapes(4)
        .Color.SchemeColor = ppForeground
    End With
End Sub
 
Code:
Sub FAQ_Text(n)
    SlideShowWindows(Index:=1).View.GotoSlide Index:=4
    i = 1
    For Each sh In ActivePresentation.Slides(n).Shapes
        With sh.TextFrame.TextRange.Font.Color
            Select Case i
                Case n
                    .SchemeColor = ppForeground
                Case Else
                    .SchemeColor = ppBackground
            End Select
        End With
        i = i + 1
    Next
End Sub
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi Skip,

Thanks for your effort and for staying with me on this. I'm still suffering from muddy thinking, though. (It's been a couple of years since I've messed with any VB or VBA.)

First, PPT apparently insists that macros driven by buttons be named Macron(). Second, doesn't the "sh" value have to be defined somewhere? (How does the macro know what "sh" is?) Third, does value n need to specifically be replaced by each instance, as in Sub FAQ_Text(1), etc.? Can a subroutine be embedded within another, as in:

Code:
Sub Macro1()
   Sub FAQ_Text(n)
      ...stuff...
   End Sub
End Sub

Thanks!
 
Hi,

Button1 macro
Code:
  FAQ_Text 1 'make textbox 1 font visible
[/code
Button2 macro
[code]
  FAQ_Text 2 'make textbox 2 font visible
[/code
...

If undeclared, sh is a Variant.  It could be declared as Shape.

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top