POWERPOINT VBA for Quiz Management (With Pictures)
Several years
after the release of Microsoft PowerPoint, many users were yet to discover the
true Power of the MS PowerPoint in terms of quiz management and programming.
In this tutorial, I
will show you some of these features and we shall look into some VBA
Programming features.
OH! You are new to programming? Don’t worry I had arranged everything in such a way you will understand.
OH! You are new to programming? Don’t worry I had arranged everything in such a way you will understand.
If you are new to
VBA, then read VBA Programming
Let’s
swing into action:
1. Open your Microsoft PowerPoint 2007 (recommended)
In the first
slide’s title text box, we are going to type something like ‘WORLD QUIZ’ in
there, so get your seat and type…
2. Create two (2) additional slides
To create new slides, on the Home
Tab, click on New Slide to create new slides. Don’t
forget that we need 2 slides, which mean you will click it twice. You got that?
Yes, I meant the slides? Good!
3. Input the following on each of the title text box of the new created slides;
On
second slide…..Input - How many days are
in a year?
On
the third slide…..Input – The first
letter of the English alphabet is?
4. To avoid confusion, we are going to delete
all the subtitles text boxes of all the slides. Left click on them, then press
‘Delete’
on your keyboard.
5. We are going to use the action buttons to
input the multiple answers.
An action button is a button which does an
action when clicked. Think of pressing the power button of your mobile phone,
the phone respond to your press by turning on. This is in likeliness
with the action buttons. When pressed, they does a specific action. More on
that later!
On
the first slide, insert an action button. If you are confuse, you can check the
image(s) for clarity, ok?
To insert an action button,
Go
to insert
choose shapes, under the action button category, choose custom.
Then
hold and drag to draw the button, release the button. Oh! That pop-up window is
not useful now, close it! Now, draw another on the second slide. Yes, like that! Very good!
6. Duplicate the box on the second slide into 3, with the original, that make them four (this is the number of choice your multiple choices quiz will have)
To
duplicate,
Click
and hold the left mouse button, press and hold Ctrl + Shift too.
Move it some space from the original one and release the mouse click. Make sure to hold the Ctrl and Shift key together. I hope you got that? Good!
7. Duplicate the four action buttons on slide 2
to slide 3.
To
do that, hold down shift key, now click on each of the four action boxes to
select them. Right click on one of them, choose copy or press Ctrl
+ C. Now, go to the third slide and press Ctrl + V to paste it.
8. Time to input the answers!
Go
to slide 2, right-click on the first action button and select ‘Edit
Text’.
Write
‘300’,
Do
the same for each of the three remaining buttons
On
the second action button, write ‘250’; third write ‘365’; fourth write ‘366’
*
To add text to other buttons, right-click on them & select ‘Edit
Text’.
Go
to slide 3, perform the same action as above,
On
the first action button write ‘A’; On
the second action button write ‘B’; On
the third action button write ‘C’; On
the first action button write ‘D’
Don’t forget that the main function of the action buttons is
to perform an action when they were clicked. To make it more interactive, we
will write a code which will tell the user if the answer he/she chose is right
or wrong. That’s where VBA comes in.
After
following the link above you can then come back. “It is always a good measure
to know what you need to know”.
9. On the PowerPoint menu bar, select the
‘Developer’ tab.
b.
Select ‘PowerPoint Options’
c.
On the ‘PowerPoint Options Screen’,
check the ‘Show Developer Tab in the Ribbon’
d.
Click ‘OK’
Under
the developer tab, select ‘Visual Basic’. I hope you got that?
Good! For the purpose of this tutorial, we will consider module as the tag of our
code.
On
the new window of Visual Basic, select the insert tab, choose ‘Module’
Write
this:
Sub
Username()
Dim
Username As String
Username
= Inputbox (prompt:=”Enter your name”, title:=”Enter your details”)
Activepresentation.slideshowindow.view.next
End
Sub
Sub
RightAns()
Msgbox(“Good
Job!”)
Activepresentation.slideshowindow.view.next
End
Sub
Sub
WrongAns()
Msgbox(“Please
Try Again”)
Activepresentation.slideshowindow.view.next
Close the VBA window
If
you don’t understand the code above, read the post on VBA Programming
10. For easy access and for our code to run without obstruction, we need to save the presentation as a ‘macro-enabled’.
Choose
‘Save As’ from the office button.
Set the ‘Save as type’ to ‘PowerPoint Macro-Enabled Presentation’
Go to Slide 1, right-click on the ‘Proceed’ button, choose ‘Edit hyperlink’, then proceed and
choose ‘Hyperlink to’, click on Run macro to enable the box, now
choose ‘Username’….Click OK.
For slide 2 & 3, same procedure as above, all you have to do is just link the run macro to ‘WrongAns’ for wrong answers and link ‘RightAns’ for right answers.
That's great! Keep it up
ReplyDeleteYou are most welcome
DeleteHow can I make a slide to be macro password-enabled so that only upon input of the required password that it does move to next slid?
ReplyDeleteYou can try this module ...
Delete###
Sub passkey()
1: passkey = InputBox("Please enter the password")
If passkey = "YOUR PASSWORD COMES HERE" Then
Activepresentation.SlideShowWindow.View.Next
Else
Goto 1
End If
End Sub
###
Please stay connected to this blog; I will organize a Tut on this very soon. Thanks for your comment and sorry for the late reply