Results 1 to 3 of 3

Thread: A New Person to VB

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Location
    Iowa
    Posts
    2

    Red face A New Person to VB

    I am needing some help with a code in Powerpoint 97. I am very new at this so go easy on me lol. I am trying to make a multiple choice quiz after a slide presentation and print the results with participants name and anwers to the questions. If someone could just tell me what I am doing wrong, that would be greatly appreciated :-)

    VB Code:
    1. Dim numCorrect As Integer
    2. Dim numIncorrect As Integer
    3. Dim userName As String
    4. Dim answer1 As String
    5. Dim answer2 As String
    6. Dim answer3 As String
    7. Dim answer4 As String
    8. Dim printableslidenum As Long
    9.  
    10. Sub GetStarted()
    11.     Initialize
    12.     YourName
    13.     ActivePresentation.SlideShowWindow.View.Next
    14. End Sub
    15.  
    16. Sub Initialize()
    17.     numCorrect = 0
    18.     numIncorrect = 0
    19.     printableslidenum = ActivePresentation.Slides.Count + 1
    20. End Sub
    21.  
    22. Sub YourName()
    23.     userName = InputBox(prompt:="Please enter first and last name?")
    24.     ActivePresentation.SlideShowWindow.View.Next
    25. End Sub
    26.  
    27. Sub DoingWell()
    28.     MsgBox ("Good job!, " & userName)
    29.     ActivePresentation.SlideShowWindow.View.Next
    30. End Sub
    31.  
    32. Sub TryAgain()
    33.     MsgBox ("Please try again, " & userName)
    34. End Sub
    35.  
    36. Sub Answer1AllofAbove()
    37.     If q1Answered = True Then
    38.         numCorrect = numCorrect + 1
    39.         answer1 = "All of the Above"
    40.     End If
    41.     q1Answered = True
    42.     DoingWell
    43.  End Sub
    44.  
    45. Sub Answer2Three()
    46.     If q2Answered = True Then
    47.         numCorrect = numCorrect + 1
    48.         answer2 = "Three"
    49.     End If
    50.     q2Answered = True
    51.     DoingWell
    52. End Sub
    53.  
    54. Sub Answer3False()
    55.     If q3Answered = False Then
    56.         numCorrect = numCorrect + 1
    57.         answer3 = "False"
    58.     End If
    59.     q3Answered = False
    60.     DoingWell
    61. End Sub
    62.  
    63. Sub Answered4AthroughCabove()
    64.     If q4Answered = True Then
    65.         numCorrect = numCorrect + 1
    66.         answer4 = "A through C above"
    67.     End If
    68.     q4Answered = True
    69.     DoingWell
    70. End Sub
    71.  
    72. Sub PrintablePage()
    73.     Dim printableSlide As Slide
    74.     Dim homebutton As Shape
    75.     Dim printbutton As Shape
    76.    
    77.     Set printableSlide = ActivePresentation.Slides.Add(Index:=6, _
    78.     Layout:=ppLayoutText)
    79. printableSlide.Shapes(1).TextFrame.TextRange.Text = _
    80.     "Results for " & userName
    81. printableSlide.Shapes(2).TextFrame.TextRange.Text = _
    82.     "Your answers" & Chr$(13) & _
    83.     "Question 1: " & answer1 & Chr$(13) & _
    84.     "Question 2: " & answer2 & Chr$(13) & _
    85.     "Question 3: " & answer3 & Chr$(13) & _
    86.     "Question 4: " & answer4 & Chr$(13) & _
    87.     "Press the Print Results button to print your answers."
    88. Set homebutton = ActivePresentation.Slides(6).Shapes.AddShape _
    89.     (msoShapeActionButtonCustom, 0, 0, 150, 50)
    90. homebutton.TextFrame.TextRange.Text = "Start Again"
    91. homebutton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
    92. homebutton.ActionSettings(ppMouseClick).Run = "Startagain"
    93. Set printbutton = ActivePresentation.Slides(6).Shapes.AddShape _
    94.     (msoShapeActionButtonCustom, 200, 0, 150, 50)
    95. printbutton.TextFrame.TextRange.Text = "Print Results"
    96. printbutton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
    97. printbutton.ActionSettings(ppMouseClick).Run = "Print Results"
    98. ActivePresentation.SlideShowWindow.View.Next
    99. ActivePresentation.Saved = True
    100. End Sub
    101.  
    102. Sub Printresults()
    103.     ActivePresentation.PrintOptions.OutputType = ppPrintOutputSlides
    104.     ActivePresentation.PrintOut from:=6, to:=6
    105. End Sub
    106.  
    107. Sub StartAgain()
    108.     ActivePresentation.SlideShowWindow.View.GotoSlide (1)  'keep getting runtime error here
    109.     ActivePresentation.Slides(6).Delete
    110.     ActivePresentation.Saved = True
    111. End Sub
    Last edited by RobDog888; Mar 22nd, 2006 at 10:50 PM. Reason: Added [vbcode] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width