Delay VB code execution

  • Thread starter Thread starter Duncan Edment
  • Start date Start date
D

Duncan Edment

I have a form with some animated buttons it.

If the user clicks on the button, it animates and everything is fine.

However, if the user TABs to the button, it doesn't work--or rather it does, but
it's too quick to see!

I have in my OnGoFocus event for the button, the following code:

Call ButtonClick(Forms!frmUATTimeSheet, "Add")
SetMarquee ("Click on this button to create a new, blank record")
Call ButtonClick(Forms!frmUATTimeSheet, "Add")

What I want to do is, after the 1st "Call ButtonClick" line, add a delay. Then,
after the 2nd "Call ButtonClick", add a delay. The effect being:

User TABs to the button
Button animates
Delays
Sets the ticker bar
Button animates
Delays

This way, the user gets to see the animation.

Any ideas?

Duncan
 
Hi,
Here's what I use whenever I want to 'pause'.
Put this code in a standard module:

'the line below goes in the Declarations section
Declare Function GetTickCount Lib "kernel32" () As Long


Public Sub Pause(HowLong As Long)
Dim u%, tick As Long
tick = GetTickCount()

Do
u% = DoEvents
Loop Until tick + HowLong < GetTickCount
End Sub

you call it like this:
Pause 1000

the values are in milliseceonds so the above line
pauses for 1 second
 
Back
Top