Second Fractions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!
I have a procedure that includes a 1 second wait period. I've been doing:
application.wait vba.now + vba.timeserial(0,0,1) and its been working fine.
I want the wait period to last HALF a second (or some other fraction). Is it
posible?
If so, how?
Best regards and thanks in advance,
Albert C
 
Add this API function declaration to General/Declarations section of your
code window...

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

and then execute this statement to delay 1/2 second....

Sleep 500

For an example....

Sub test()
Debug.Print Timer
Sleep 500
Debug.Print Timer
End Sub

The two printed values should differ by 1/2 second.

Rick
 
EXCELENT!!!!!
Thank you Sir!!!!!

Rick Rothstein (MVP - VB) said:
Add this API function declaration to General/Declarations section of your
code window...

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

and then execute this statement to delay 1/2 second....

Sleep 500

For an example....

Sub test()
Debug.Print Timer
Sleep 500
Debug.Print Timer
End Sub

The two printed values should differ by 1/2 second.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top