P
Preschool Mike
I have four questions about generating items randomly.
I know how to generate numbers randomly, but how do I generate
1. Numbers less than 5 but greater than -1?
2. Two digit numbers.
Also is it possible to generate random letters in a shape or text box and
random pictures?
I'm currently using the code below to generate my random numbers.
Dim First As Integer
Dim Second As Integer
Dim Answer As Integer
Sub Initalize()
Randomize
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub RandomNumber()
First = CStr(Int(Rnd() * 10))
Second = CStr(Int(Rnd() * 10))
ActivePresentation.Slides(2).Shapes("Box1").TextFrame.TextRange.Text = First
ActivePresentation.Slides(2).Shapes("Box2").TextFrame.TextRange.Text = Second
End Sub
Sub InsertAnswer()
Answer = InputBox("Type in the answer")
If Answer = First + Second Then
ActivePresentation.Slides(2).Shapes("Box3").TextFrame.TextRange.Text = Answer
MsgBox ("That's the correct answer")
Else
MsgBox ("That's not correct, try again")
End If
End Sub
I know how to generate numbers randomly, but how do I generate
1. Numbers less than 5 but greater than -1?
2. Two digit numbers.
Also is it possible to generate random letters in a shape or text box and
random pictures?
I'm currently using the code below to generate my random numbers.
Dim First As Integer
Dim Second As Integer
Dim Answer As Integer
Sub Initalize()
Randomize
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub RandomNumber()
First = CStr(Int(Rnd() * 10))
Second = CStr(Int(Rnd() * 10))
ActivePresentation.Slides(2).Shapes("Box1").TextFrame.TextRange.Text = First
ActivePresentation.Slides(2).Shapes("Box2").TextFrame.TextRange.Text = Second
End Sub
Sub InsertAnswer()
Answer = InputBox("Type in the answer")
If Answer = First + Second Then
ActivePresentation.Slides(2).Shapes("Box3").TextFrame.TextRange.Text = Answer
MsgBox ("That's the correct answer")
Else
MsgBox ("That's not correct, try again")
End If
End Sub