Download presentation
Presentation is loading. Please wait.
Published byScott Anderson Modified over 9 years ago
1
Lesson 1
2
Security At the menu bar at the top you will see the word Tools. Click your mouse on Tools scroll down to Macro. Move the Mouse over and down to the word Security.
3
Setting Security You must change the security to low and the trusted Publishers both boxes should be clicked.
4
Starting Visual Basic Editor Click on the word Tools again then scroll down to the word Marco and select Visual Basic Editor.
5
Visual Basic Editor Click on the word Insert and then select the word Module
6
Writing Program We write our programs in box under the word General. Let's get started!
7
Declaring Variables The word Dim tells the computer at we want to create a variable. Next we must name the variable. In the example above, the names are numCorrect, numIncorrect, and userName. Finally, we must tell the computer how we want to store these variables. Integer means numbers. String means letters or words.
8
Subroutines A subroutine in a small program that we use as a macro in PowerPoint. The word Sub tells the computer that we are going to create a mini program to run in PowerPoint. After the word Sub we must name the program and remember that it must be one word. You will also notice that after pressing enter the phase End Sub will appear.
9
Sub GetStarted() We can run other subroutines in a subroutine. We are going to create two subroutines after this one. They are going to be Initialize and YourName. So to run other subroutines in a subroutine, we just type the names of the subroutines. Now for the line ActivePresentation.SlideShowWindow.View.Next. This command tells the computer to move to the next slide.
10
Sub Initialize() In the Sub Initialize, we have to set the beginning value of numCorrect and numIncorrect to zero. The reason is plain to see. If someone took the test and made a score of 4 then another student took the score and made a 4 also, the message box would say that person got 8 instead of 4. We must reset the value of those two variables.
11
Sub YourName() There are two kinds of dialog boxes that we use. One is a message box that tells something. The other box is an Input box where we ask for information from the user. In this case, we are asking for information to be store in the variable userName. In this case, we are asking for their name.
12
Sub RightAnswer() This subroutine is going to keep score and tell the person that we got the right answer. First we have to take numCorrect and add one to score. Next, we are going to create another subroutine called DoingWell which will give a message box. Finally, ActivePresentation.SlideShowWindow.View.Next goes to the next slide.
13
Sub DoingWell() As I mention before we have two kinds of dialog boxes. In this subroutine we are going to create a message box. We use MsgBox to tell the computer to create a message box. Then we must add ( ) and quotation marks. Any words inside the " " will be shown in the message box. You should also notice that there is an & sign in the (). This tells the computer that we want to add other items to the message. In this case we want to add the userName to the message. Variables never have " " marks around them.
14
Sub WrongAnswer() Sub WrongAnswer is almost like Sub RightAnswer. Except we are going to add 1 to numIncorrect and we are going to write another subroutine called DoingPoorly. The last statement in the subroutine moves to the next slide.
15
Sub DoingPoorly() Here we created a message box telling the user that he/she missed the question. Again notice that the words inside the quotation marks will appear in the box. Also, we add an & sign and then the userName.
16
Results - Sub Feedback() This subroutine will tell the user how well he did. First, you will notice that we used a message box. It is going to print You got in the message box. Then the computer will go to the variable numCorrect and place that value in the message box. Next, it will print out of in the message box. Third, we have the computer add the two variables to get the total number of questions. Finally, it will put the userName in the message box.
17
Making the Quiz First, we want to create an action button and link the button to the marco GetStarted. After you click on the autoshapes scroll up to action buttons and pick the blank button. Using the mouse draw the an action button. Procedure is here!
18
Linking Action Button Click on the radio button Run Marco and select GetStarted from the dropdown list. Then click OK! You linked the button!
19
Making Answer Buttons Create another action button and link it to WrongAnswer. Then click OK!
20
Making More Buttons Click on the button that you just created. Using the ctrl key and the letter C to copy button. Now use the Ctrl key and the letter V and paste 4 more buttons. All of these buttons have the wrong answer link. By right clicking the mouse on the button that you want the right answer to be. Choose action settings change the marco to RightAnswer. By clicking on the button, you can type letters on the buttons.
21
Adding More Questions By clicking on the extra button on your first question. Press Ctrl + X to cut the button from that slide. Create a new slide and then press Ctrl + V to paste the button. Click on the button then press Ctrl + C to copy the button. Now press Ctrl + V and paste 4 more buttons. We always keep the last button to move to the next slide. Remember to change the button that you want to be correct. Click on the button and do a right click with the mouse. Select action settings and change the macro to RightAnswer. Type A, B, C, and D on the buttons. Follow the same procedure until you are done with your questions.
22
Results Create another action button, This time link the macro to Feedback and then press ok. You have just finished your quiz. Try it out!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.