Did you know it’s possible to create your own quiz slides in Microsoft PowerPoint using its macro functions and doing a little programming in Visual Basic for Applications (VBA)?
You can use quiz slides to make presentations more engaging and fun. They work something like this: Each slide asks a question and displays answer choices. Quiz-takers then click on the answer they think is correct. If they answer correctly, a Congratulations message appears and they automatically move on to the next slide. If they choose a wrong answer, they receive a “try again” message. The slideshow will not advance until they select the correct answer.
You may think that working with VBA is too complicated, but it’s easier than you might think. This VBA code is easy to understand and, for this tip I was able to use Visual Basic to create a 10-slide quiz in less than an hour.
Step 1: Create multiple-choice slides
The first step is to create the question slides. In PowerPoint, start a new slide using the Title Only slide layout. Type the first question in the title placeholder.
To add the multiple-choice answers, go to the Draw toolbar and choose AutoShapes> Action Buttons. (2007: Home tab> Drawing group> Shapes> Action Buttons section) Then choose the blank action button. Now click on the slide and the new button will appear. When the Action Settings dialog box appears, choose Cancel. You’ll return to this box later in the tutorial.
Resize and position the button on the slide. For consistency, size the button to allow for the longest text answer. Format the button as desired.

answer buttons
Right-click on the button, choose Add Text from the shortcut menu, and type the first answer. Now select the button, copy it to the Clipboard, and paste additional copies of the button graphic for the remaining answers you’ll need on the slide.
When all the buttons are in place, select each individually and edit its text. You can also align and distribute the answer buttons on the slide. Select them all. Choose Draw toolbar> Align or Distribute, Align Left, then Draw toolbar> Align or Distribute> Distribute Vertically. (In PowerPoint 2007: Drawing Tools Format tab> Arrange group> Align button> Align Left, then Align button>Distrubte Vertically)
Repeat this process to create each additional question slide.
Tip: Within the Slide Sorter view, you can COPY (CTRL+C) the first question slide and PASTE it as many times as needed to quickly create the remaining question slides. Then return to Normal view to edit each slide’s text.
On your final quiz slide, create an action button with the word End, and place it on the slide.
Step 2: Create macros
When the Q & A slides are done, you’re ready to create the macros using PowerPoint’s Visual Basic Editor. Before you begin, make sure that only the presentation you are currently working on is open.
To open the Visual Basic Editor, choose Tools> Macro> Visual Basic Editor.
In 2007, you first need to display the Developer tab if it isn’t already displayed. (By default, it is not displayed.) Choose Office button> PowerPoint Options. In the Popular category, check the Show Developer Tab in the Ribbon check box. Then, to open the Visual Basic Editor, choose Developer tab> Code group> Visual Basic.
The editor opens in a new window. The right side of the window will be gray. From the insert menu choose module and you’ll see a blank white area where you can type a macro. We’ll create three macros.
We’ll start with the code for the wrong answer. In the big blank space on the right, type the following on three lines:
Sub Wrong()
MsgBox (“Sorry, that’s not right. Please try again.”)
End Sub
Here, the MsgBox line wraps to two lines; you should type it all on one line.
In certain situations, if you make a mistake, the editor will warn you, but the message may not be clear to you. Most often the mistake is a result of mistyping the code. You may have left out one of the quotation marks or the closing parenthesis at the end of a line. Double-check your typing and make adjustments until the Editor shows no warnings.
Next is the code for the right answer. At the end of the line reading “End Sub,” press Enter. This begins a new code group. Then type the following four lines:
Sub Right()
MsgBox (“That’s right!”)
SlideShowWindows(1).View.Next
End Sub
This code is similar to the previous macro, except for the third line, which advances the quiz-taker to the next slide.
On the final slide, you don’t want the slideshow to advance to the next slide because that starts the presentation all over again. Instead, you want viewers to use a button that exits the slideshow. So after the previous “End Sub,” press Enter again and type your final piece of code:
Sub RightLast()
MsgBox (“Congratulations!”)
End Sub

macro to exit to exit the slideshow
Step 3: Attach macros to buttons
To return to PowerPoint from the Visual Basic Editor, click the View Microsoft PowerPoint icon (upper left-hand corner, under the File menu link). Leave the Visual Basic Editor open in the background. In PowerPoint, save the presentation, as this saves the new macros as well.
Go to your first question slide and select the button with the correct answer. Note: Select the entire button, not just the text on the button. You do this by clicking on the border around the edge of the button.
Right-click the button and choose Action Settings from the shortcut menu. The Action Settings dialog box appears. Choose the Mouse Click tab, and in the Action on Click section, check the Run Macro option and select your new Right macro from the drop-down list. (Notice that all the macros on this list are named for the three pieces of code you created in the Visual Basic Editor.) Click OK.
Now select each of the wrong answers and follow the same procedure, except select the Wrong macro from the drop-down list.
Before going on to the other slides to assign the proper macros, try out the buttons on the first slide. Go into Slide Show view. Click on a wrong answer. A text-message box should pop up indicating you have chosen the wrong answer. Click OK to close the box. Check the other wrong answers on the slide to make sure they also work. Finally, select the correct answer. This time, the text-message box should indicate you have chosen the right answer. Click OK and the slideshow will automatically advance to the next slide.
With the first slide working properly, edit the rest of the presentation, attaching the appropriate macros to the buttons. On the last slide, assign the RightLast macro to the correct answer so that quiz-takers stay on the last slide.
Remember the End button you created on this final slide? Right-click on that button and choose Action Settings. In the Action Settings dialog box, choose the Hyperlink To option and choose End Show from the drop-down list. Click OK. Quiz-takers can use this button when they’re finished answering all the questions.
At this point, be sure to save the PowerPoint file.
Step 4: The final setup
To prevent the quiz-takers from clicking through without answering all the questions, choose Slide Show> Set Up Show. In the Set Up Show dialog box choose the Browsed at a Kiosk (Full Screen)” option under the Show Type area. Click OK. With this setting, the only way someone can get out of the presentation is to use the ESC key.

final setup
Now, go into Slide Show mode and try your quiz, making sure all wrong answers and right answers use the proper macro. That wasn’t so difficult, was it?
Related posts:






thanks for the codes !!
)
Hello there,
When I run my presentation, I can not seem to get this to work. I click on the options and the do not run to the next slide or come up wrong. It stays on the same slide and when I click on a box a dotted line appears around it!
any help?
Ta
Daniel
That is usually because of PowerPoint’s security settings. I’d need to know which version of PowerPoint you have to show you how to change them. But start with Tools>Options or File/Application Button>Options.
I have created a quiz integer add and subtract macros button….that was eay. But when I use my required action button to run my Macros, such as a progressive score button, the Macros window “pops-up” within that slide and is much smaller than the slide itself. It works just fine but is there a way to for the button to make this score open in it’s own slide to keep score? In other words, can I make that pop-up window an actual slide? Thanks for your input please.
R. Owens
I’m not sure I understand and I’m not a programmer, but you can programmatically create a new slide and display the results of calculations there.
In my book PowerPoint for Teachers I have a chapter on creating a quiz with VBA using code from David Marcovitz. It displays the score on a list slide that the code creates on the fly. At http://www.loyola.edu/edudept/powerfulpowerpoint/, you can look at some of his code. He lists it by chapter and I don’t know which chapter would have the code you need. If you’re creating more complex quizzes, I recommend that you buy his book. Here’s an Amazon.com link.
Hi isnt
SlideShowWindows(1).View.Next supposed to be SlideShowWindow(1).View.Next no s after window???
either way I get syntax error but this almost works
ActivePresentation.SlideShowWindow(1).View.Next
2003 PPT
actually all I want is a text box to hold a value (a score) and have a button add 1 to the value in the text box…
can you assist – you can answer at my email – and if it works feel free to add to this post
Try it like this: ActivePresntation.SlideShowWindow.View.Next
For more information than that, you’d need to ask a programmer, which I am not. Go to the PowerPoint Discussion Group at http://answers.microsoft.com/en-us/office/forum/powerpoint?tab=all and ask the question there. A few programmers frequent the forum.
Great work. The problem I have is when people take the test and they know programming they can right click on the buttons and look at the hyperlink to discover the correct answer. How do I fix that?
Hello, thank you for the info- I have set up several quizzes with your instructions. I know I can easily assign a sound to an action box. How do I asign a sound to the VBS message box? Right now, every time the message boxes appear, the “error” sound is there. I would like to keep it for the wrong answers, but have an “applause” sound for the right answers. Thanks!
Rose,
My VBA skills are pretty limited, so I don’t know how to add a sound in VBA. The error sound might be, well, an error in the code. You might try a non-VBA technique for creating the quiz, but I only have that written out in my ebook, 101 Advanced Techniques Every PowerPoint User Should Know.. You can see a demo at http://www.ellenfinkelstein.com/pptblog/create-a-quiz-in-powerpointdemo-of-technique-7-from-my-e-book/.
Ellen
Hi there,
for some reason when i right click my action button, i dont get the action settings, how do i get the action settings?
Thanks
Hello Ellen,
How can I get my Powerpoint quiz to self grade? I would like for my students to print and send me their results.
Thanks.
Clint,
I have instructions in my book, PowerPoint for Teachers. You can find it on Amazon. It’s too much to put in a blog post–the instructions take up a whole chapter of the book!
I want to Visul Basis coding any quiz contest.
In addition to the code on this page, I have a whole chapter in my book, PowerPoint for Teachers. You can buy it from Amazon.com at this link: http://www.amazon.com/gp/product/078799717X?ie=UTF8&tag=ellenfinkelstein&linkCode=as2&camp=1789&creative=9325&creativeASIN=078799717X
Hello Ellen
Thank you for I see as great work which will be my first step in the world of VBA. I’ll always remember this tutorial.
For some reason the (right) does not make the slides advance, it shows the message and remains at the same slide
It could take quite a while to troubleshoot and I’m not a serious VBA programmer. I suggest that you go to Microsoft’s discussion group and there are VBA programmers there who will help you.
http://answers.microsoft.com/en-us/office/forum/powerpoint?tab=all
Good luck!
Sammer wrote “for some reason when i right click my action button, i dont get the action settings, how do i get the action settings?”
That’s becuase Ellen got it WRONG !!! In PowerPoint 2007 you don’t get “Action Settings” on right-click, you get “Hyperlink”, and from there you can progress.