Below in this code, what is role of do event? And why did use this key word?

Do while(timer<start+pause)

Do events


  yadwendra ray


Let suppose you have 2 task in VBA and 1st task will take more time to finish, rather than waiting you can finish your 2nd task with the help of "DoEvents"

Try with below Example: -

1. Create a Form with "TextBox" and "2 Command Button"

'--Paste in Command Button 1 in FORM

Private Sub CommandButton1_Click()   'My 1st Task'

Dim i As Long

For i = 1 To 2000000

TextBox1.Text = i


Next i

End Sub

'--Paste in Command Button 2 in FORM

Private Sub CommandButton2_Click()      'My 2nd Task'

MsgBox "hello"

End Sub

I hope this will be helpful.....

  Kuldeep Singh       10 Dec 2017       0       0     

Post Your Answers:

Please use the CODE HIGHLIGHT Button to format/highlight your codes if any