VBA: Send Sub to sleep

If one, like me, has the need for a timer at his desk that notifies when the cup of tea is ready and the teabag should be removed, there is the multipurpose-tool MS Excel-VBA.

This Sub uses the “Sleep”-Function of the “kernel32.dll” in a VBA-Macro.

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub TeaTimer()

Dim time As String

time = InputBox("Enter Teatime (Min):")

If time = "" Then
    Exit Sub
End If

time = time * 60 * 1000

Sleep time

MsgBox "Enjoy your tea!", vbInformation

End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: