While attempting to access an external API function set from within a macro I found it necessary to add in a delay to allow time for the external API to process a selection.
Instead I implemented the delay using the functions Now and DateAdd:
Function Delay(Seconds As Long)
Dim StopTime As Date: StopTime = DateAdd("s", Seconds, Now)
Do While Now < StopTime
DoEvents
Loop
End Function
Updated below for millisecond precision
Function Delay(Seconds As Single)
Dim StopTime As Single: StopTime = Timer + Seconds
Do While Timer < StopTime
DoEvents
Loop
End Function