Better way to delay macro other than Application.Wait or Application.Sleep?

前端 未结 1 1124
日久生厌
日久生厌 2021-01-16 13:34

I created a status bar that works off of application.wait. In a sense, that worked quite well. However, I want to be able to update the status bar while working on other w

1条回答
  •  清歌不尽
    2021-01-16 14:35

    Use this delay function instead of Application.Wait

    Private Sub delay(seconds As Long)
        Dim endTime As Date
        endTime = DateAdd("s", seconds, Now())
        Do While Now() < endTime
            DoEvents
        Loop
    End Sub
    

    0 讨论(0)
提交回复
热议问题