Function Basic Extensions Class

TrueEveryNSeconds

Return True once every N seconds, and also Return True the first time this function is called.

Signature (Visual Basic / VBA)

Public Function TrueEveryNSeconds( _
    Optional ByVal vSeconds As Variant _
    ) As Boolean

Code Example

    TrueEveryNSeconds(0) : SleepBlocking(3.5) : ? TrueEveryNSeconds(5) : SleepBlocking(3.5) : ? TrueEveryNSeconds(5)
    False
    True

Parameters

Parameter Description
vSeconds The number of seconds that must have elapsed before the function will return True. It is the number of seconds that must have elapsed since either 1) this function was first called, or 2) the function last returned True. vSeconds default to 0 (zero) if it is missing or Null or cannot be fixed up to a number, meaning that the function will return True and reset the start time.

Notes & Version History

Warning This function calls the Visual Basic Timer function to determine if the specified number of seconds have elapsed since the function last returned True. vSeconds is generally be accurate to 1/18 of a second because of this.