Module Module1
    Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Integer
    ''Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Public Function DelayMs(TimeMs As Long) As Boolean
        Dim StartTime As Long
        Dim CurrTime As Long

        StartTime = GetTickCount
        CurrTime = GetTickCount

        While (CurrTime - StartTime <= TimeMs)
            CurrTime = GetTickCount
        End While

        Return True
    End Function
End Module