Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-09-2011, 10:02 PM
JohnWilson JohnWilson is offline Simple VBA macro error Windows 7 Simple VBA macro error Office 2010 (Version 14.0)
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

You need to change a couple of things

NumberCorrect and Number Wrong should be declared as Integer not String
UserName is a String not an Integer

In all the MsgBox lines change + to &
Code:
Dim numberCorrect As Integer
Dim UserName As String
Dim numberWrong As Integer
Sub YourName()
UserName = InputBox(Prompt:="Type Your Name")
MsgBox " Welcome to the Quiz " & UserName, vbApplicationModal, " Quiz"
End Sub
Sub Correct()
MsgBox " That is correct, move on " & UserName, vbApplicationModal, " Quiz"
numberCorrect = numberCorrect + 1
SlideShowWindows(1).View.Next
End Sub
Sub Wrong()
MsgBox " Sorry Thats the wrong answer " & UserName, vbApplicationModal, " Quiz"
numberWrong = numberWrong + 1
SlideShowWindows(1).View.Next
End Sub
Sub Start()
numberCorrect = 0
numberWrong = 0
YourName
SlideShowWindows(1).View.Next
End Sub
Sub Results()
MsgBox ("You Got " & numberCorrect & " out of " & numberWrong + numberCorrect & ", " & UserName), vbApplicationModal, " Quiz "
SlideShowWindows(1).View.Next
End Sub
Reply With Quote
 

Tags
macros, simple, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple VBA macro error Runtime Error 4120 in Word 2007 macro Frankwlc Word 5 11-28-2011 01:54 AM
Macro Error 5174 muster36 Word VBA 0 08-12-2011 03:34 AM
Simple or what? nebb Publisher 0 09-23-2010 07:00 AM
Simple template kieransymes Word 0 03-08-2010 02:13 AM
Simple macro undoable? garon5 Outlook 0 04-20-2007 10:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft