How to give a time delay of less than one second in excel vba?

后端 未结 10 2141
孤街浪徒
孤街浪徒 2020-11-29 06:14

i want to repeat an event after a certain duration that is less than 1 second. I tried using the following code

Application.wait Now + TimeValue (\"00:00:01\         


        
10条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 06:54

    I found this on another site not sure if it works or not.

    Application.Wait Now + 1/(24*60*60.0*2)
    

    the numerical value 1 = 1 day

    1/24 is one hour

    1/(24*60) is one minute

    so 1/(24*60*60*2) is 1/2 second

    You need to use a decimal point somewhere to force a floating point number

    Source

    Not sure if this will work worth a shot for milliseconds

    Application.Wait (Now + 0.000001) 
    

提交回复
热议问题