I would like a 1 second delay in my code. Below is the code I am trying to make this delay. I think it polls the date and time off the operating system and waits until the
With Due credits and thanks to Steve Mallroy.
I had midnight issues in Word and the below code worked for me
Public Function Pause(NumberOfSeconds As Variant)
' On Error GoTo Error_GoTo
Dim PauseTime, Start
Dim objWord As Word.Document
'PauseTime = 10 ' Set duration in seconds
PauseTime = NumberOfSeconds
Start = Timer ' Set start time.
If Start + PauseTime > 86399 Then 'playing safe hence 86399
Start = 0
Do While Timer > 1
DoEvents ' Yield to other processes.
Loop
End If
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
End Function