ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Second Fractions (https://www.excelbanter.com/excel-programming/399655-second-fractions.html)

Albert

Second Fractions
 
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

Rick Rothstein \(MVP - VB\)

Second Fractions
 
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


"Albert" wrote in message
...
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



Albert

Second Fractions
 
EXCELENT!!!!!
Thank you Sir!!!!!

"Rick Rothstein (MVP - VB)" wrote:

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


"Albert" wrote in message
...
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





All times are GMT +1. The time now is 06:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com