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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powerpoint Quiz question

Status
Not open for further replies.

Sheltered

Programmer
Nov 26, 2002
55
GB
Hi, hope someone can help.
I have a powerpoint presentation with several questions on.
Each question has a simple 'true' or 'false' answer.
I want it so that if a user clicks the right answer it puts a text box at the bottom of the page which says 'correct' and if he clicks the wrong answer it says 'incorrect'.

I recorded a macro to change the text in the textbox which works if i run it from macros box. However if i run the presentation when i click the answer it does nothing.

This is the macro:
Code:
Sub Macro4()
'
' Macro recorded 05/07/2004 
'

    ActiveWindow.Selection.Unselect
    ActiveWindow.Selection.SlideRange.Shapes("Text Box 285").Select
    ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
    ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=2).Select
    ActiveWindow.Selection.TextRange.Text = "correct"
    ActiveWindow.Selection.Unselect
End Sub

Any help to get this going would be much appreciated.
Thanks
Pete
 
have the tries making a macro for each option button?

something like:

Private Sub OptionButton1_Click()
ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "You got it right"
End With
ActiveWindow.Selection.Unselect
End Sub
 
Thanks apeoortje, i have given that a go however i am getting the following error message...

Run-time error '-2147188160 (80048240)':
Application (unknown member):Invalid request. There is no currently active document window.

I have done a quick google search on the error with no luck.
Any ideas.

Pete
 
have a look at my faq faq707-1698 on naming shapes in powerpoint

reason your code is not working is because when you run the slide show , it is no longer a "activewindow" you need to reference the slides and the controls by name.



Chance,

Filmmaker, gentleman and soon to be a mac user
,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top