VBA Quiz Code With Auto Results

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Dim UserName As String

Dim numberCorrect As Integer


Dim numberWrong As Integer

Sub YourName()
UserName = InputBox(Prompt:="Type Your Name!")
MsgBox "Welcome: " + UserName, vbApplicationModal, "Sample Quiz"
End Sub

Sub Correct()
MsgBox " Well Done! That's The Correct Answer " + UserName, vbApplicationModal, "Sample Quiz"
numberCorrect = numberCorrect + 1
ActivePresentation.SlideShowWindow.View.Next
End Sub

Sub Wrong()
MsgBox "Sorry! That's The Wrong Answer " + UserName, vbApplicationModal, "Sample 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 & " Correct Answers, " & numberWrong & " Wrong Answers " & UserName), vbApplicationModal, "Sample Quiz"
End Sub

You might also like