Results 1 to 2 of 2

Thread: PPT Macro problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2017
    Posts
    4

    PPT Macro problem

    I am using the same code from another post. My problem is that the questions responses lose their Actions. I go to each Q and attch an action to each possible response. Insert....Action...run macro...

    But I seem to lose the actions I assign

    Dim Username As String
    Dim numberCorrect As Integer
    Dim numberWrong As Integer

    Sub YourName()
    Username = InputBox(Prompt:="Type Your Name!")
    MsgBox " Welcome to the Quiz " + Username, vbApplicationModal, " Practice Quiz"
    ActivePresentation.SlideShowWindow.View.Next
    End Sub

    Sub Correct()
    MsgBox " Well Done! That's the correct answer! " + Username, vbApplicationModal, " Practice Quiz"
    numberCorrect = numberCorrect + 1
    ActivePresentation.SlideShowWindow.View.Next
    End Sub

    Sub Wrong()
    MsgBox " Sorry, that's the wrong answer!" + Username, vbApplicationModal, " Practice Quiz"
    numberWrong = numberWrong + 1
    ActivePresentation.SlideShowWindow.View.Next
    End Sub

    Sub Start()
    numberCorrect = 0
    numberWrong = 0
    YourName
    ActivePresentation.SlideShowWindow.View.Next
    End Sub

    Sub Results()
    MsgBox ("You got " & numberCorrect & " out of " & numberCorrect & numberWrong & ", " & Username), vbApplicationModal, " Practice Quiz"
    numberCorrect = 0
    numberWrong = 0
    End Sub

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: PPT Macro problem

    But I seem to lose the actions I assign
    as that is not part of the code, it is difficult for anyone else to see what is happening

    as i do not have powerpoint i can not test for you, someone else may be able to
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

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