VBA Sleep Doesn't Work

后端 未结 7 1346
礼貌的吻别
礼貌的吻别 2020-12-03 10:57

I know I\'m doing something wrong here. I\'m trying to use the sleep function to delay my code, but I get \"Sub or Function not defined\" error. Any tips?

7条回答
  •  醉话见心
    2020-12-03 11:22

    Everything I've tried seems to hang the application, including Application.Wait. This seems to work though:

    waitTill = Now() + TimeValue("00:15:00")
    
    While Now() < waitTill
        DoEvents
    Wend
    

提交回复
热议问题