Is there an equivalent to Thread.Sleep() in VBA

后端 未结 8 1258
孤街浪徒
孤街浪徒 2020-12-01 13:38

Is there an equivalent to Thread.Sleep() in Access VBA?

相关标签:
8条回答
  • 2020-12-01 14:31

    Another way without using kernel32:

    Dim started As Single: started = Timer
    
    Do: DoEvents: Loop Until Timer - started >= 1
    
    0 讨论(0)
  • 2020-12-01 14:31

    All of the rest of the methods to make Excel wait result in Excel becoming completely unresponsive. The solution to make Excel wait while ensuring a responsive UI is to call this wait Sub with the number of seconds to wait.

        Sub Wait(seconds As Integer)
          Dim now As Long
          now = Timer()
          Do
              DoEvents
          Loop While (Timer < now + seconds)
        End Sub
    
    0 讨论(0)
提交回复
热议问题