2 Replies - 2337 Views - Last Post: 02 April 2011 - 07:05 PM

#1 Reverand Dave   User is offline

  • D.I.C Regular
  • member icon

Reputation: 3
  • View blog
  • Posts: 375
  • Joined: 27-July 08

Timedelay function

Posted 23 October 2008 - 10:25 AM

Description: Function works value of .01 of a second on up. example for use is: Private Sub PanicButton_Click() Me.Hide TimeDelay 10 'ten seconds of delay Me.Show End Sub A quick and simple time delay function that works in both VB6 and VBA. Especially good if you are too lazy to use a timer. Works especially well if you just want to have a short delay in the middle of an event.

Function TimeDelay(Delay As Double)
  Dim PauseTime, Start
  PauseTime = Delay    ' Set duration.
  Start = Timer    ' Set start time.
  Do While Timer < Start + PauseTime
    DoEvents    ' Yield to other processes.
  Loop
End Function
'Just insert "Timedelay XX"  Where XX = the amount of delay time you need.


Is This A Good Question/Topic? 0
  • +

Replies To: Timedelay function

#2 pmyk   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 12-June 09

Re: Timedelay function

Posted 12 June 2009 - 10:39 AM

Thanks a lot for this useful Function! Great help indeed!
Was This Post Helpful? 0
  • +
  • -

#3 perkinelmer   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 07-December 07

Re: Timedelay function

Posted 02 April 2011 - 07:05 PM

What will happen at midnight when timer resets? It will never see (24 hours+ delay).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1