Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Kenneth Bennett   on Sep 07 In MS Office Category.

  
Question Answered By: Rocco Anderson   on Sep 07

if you look at the code, you will see i'm a
beginner, but I am enjoying trying to break the code now!! Althogh
could have thrown the laptop out of the windown many times before!!

Public question As Integer
Public score As Integer

Private Sub SpinToWin_Activate()

question = 2 'this sets this as the first question everytime you
load it
score = 0
Questions.Cells(1, 6) = question 'showing the question number on
spreadsheet 2


End Sub

Private Sub answer_a_lbl_Click()
'question 1 has been clicked as correct answer (the answer to
question one is in answer_a_label)
'location of correct answer is (1,5)also held in variable called
question

If Questions.Cells(question, 5) = 1 Then
score = score + 1
Questions.Cells(1, 7) = score
MsgBox "Well Done, you may continue with next question"


Dim Pausetime, Start, Finish, Angle As Integer
Dim Delaytime As Single

Start = Timer
Angle = Int(360 * Rnd)
Delaytime = 1.5

Do While Timer < Start + 5
SpinToWin.Shapes("spinner").Rotation = Angle
Angle = Angle + 10

delay (Delaytime)
Delaytime = Delaytime ^ 1.025
If Angle > 359 Then Angle = 0

Loop

Nxt_question

Else

MsgBox "D'oh! Try again!"
End If

End Sub
Private Sub answer_b_lbl_Click()
'question 1 has been clicked as correct answer (the answer to
question one is in answer_a_label)
'location of correct answer is (1,5)also held in variable called
question

If Questions.Cells(question, 5) = 2 Then
score = score + 1
Questions.Cells(1, 7) = score
MsgBox "Well Done, you may continue with next question"

Dim Pausetime, Start, Finish, Angle As Integer
Dim Delaytime As Single

Start = Timer
Angle = Int(360 * Rnd)
Delaytime = 1.5

Do While Timer < Start + 5
SpinToWin.Shapes("spinner").Rotation = Angle
Angle = Angle + 10

delay (Delaytime)
Delaytime = Delaytime ^ 1.025
If Angle > 359 Then Angle = 0

Loop

Nxt_question

Else

MsgBox "D'oh! Try again!"
End If

End Sub
Private Sub answer_c_lbl_Click()
'question 1 has been clicked as correct answer (the answer to
question one is in answer_a_label)
'location of correct answer is (1,5)also held in variable called
question

If Questions.Cells(question, 5) = 3 Then
score = score + 1
Questions.Cells(1, 7) = score
MsgBox "Well Done, you may continue with next question"

Dim Pausetime, Start, Finish, Angle As Integer
Dim Delaytime As Single

Start = Timer
Angle = Int(360 * Rnd)
Delaytime = 1.5

Do While Timer < Start + 5
SpinToWin.Shapes("spinner").Rotation = Angle
Angle = Angle + 10

delay (Delaytime)
Delaytime = Delaytime ^ 1.025
If Angle > 359 Then Angle = 0

Loop

Nxt_question

Else

MsgBox "D'oh! Try again!"
End If

End Sub
Private Sub q_start_Click()


Dim Pausetime, Start, Finish, Angle As Integer
Dim Delaytime As Single

Start = Timer
Angle = Int(360 * Rnd)
Delaytime = 1.5

Do While Timer < Start + 5
SpinToWin.Shapes("spinner").Rotation = Angle
Angle = Angle + 10

delay (Delaytime)
Delaytime = Delaytime ^ 1.025
If Angle > 359 Then Angle = 0

Loop

Nxt_question

End Sub

Private Sub Nxt_question()

question = question + 1
Questions.Cells(1, 6) = question
' adds one to the value which is used as the variable - question

SpinToWin.question_label = Questions.Cells(question, 1)
' displaying in label on SpinToWin the data from sheet1

SpinToWin.answer_a_lbl = Questions.Cells(question, 2)

SpinToWin.answer_b_lbl = Questions.Cells(question, 3) '
Displaying the answers

SpinToWin.answer_c_lbl = Questions.Cells(question, 4)

End Sub

Private Function delay(t As Integer)

For timedelay = 2 To t
DoEvents
Next timedelay

End Function

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on New to VBA Or get search suggestion and latest updates.


Tagged: