A Super Easy Delay Timer

By | 2002-06-01

A delay timer so easy, this paragraph is longer. I had to submit this easy code because it is not on this website. Uses no API, and it is very handy!!

Original Author: Patrick K. Bigley

Assumptions

Make a form with a command button ont it. Paste the code into the command button. This sample has a 3 second delay, then you hear a beep.

Code

Private Sub Command1_Click()
Dim Start As Long
Start = Timer
  
  Do While Timer < Start + 3 'a 3 second delay (Change to any numer you want)
   DoEvents  ' Yield to other processes.
  Loop
  
Beep

End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.