In this article, I will show you how to set an alarm clock in Excel. While working in Excel, we may want to remind ourselves of something important at a particular time. If you are looking for achieving this task, you have come to the right place. Here, I will try to devise multiple ways of setting an alarm clock in Excel. So, let’s get started.
Download Practice Workbook
Download this practice workbook to exercise while you are reading this article.
3 Useful Methods to Set Alarm Clock in Excel
In this section, we will demonstrate 3 effective methods to set an alarm clock in Excel with appropriate illustrations. In the 1st method, we will see how to set an alarm clock with 3 beep sound. Next, in the 2nd method, we will set an alarm clock in Excel with a custom ringtone. Finally, the 3rd method is the most fascinating one. Here, we will display a notification message and read out the message at the alarm time.
1. Setting Alarm Clock with Beep Sound in Excel
In the 1st method, we will try to run a VBA module to set an alarm clock that will play three beep sounds in during alarm in Excel. To know more about this method, read and follow the steps below.
- First, open the Visual Basic Editor by clicking Alt+F11. Alternatively, you can go to the Developer tab and click on Visual Basic.
- Now, insert a new module by going to Insert >> Module.
- Now, write the following code in the module.
'Alarm with beep sound Sub Beep_Alarm() Dim beepat As String beepat = InputBox("Give Alarm at", "hh:mm:ss " & _ Format(Now, "mm:hh"), "23:30") If beepat = "" Then MsgBox "terminated" Exit Sub End If Application.OnTime TimeValue(beepat), "Beep_Me" End Sub Sub beep_me() Beep Application.OnTime (Now + TimeSerial(0, 0, 0.8)), "beep_me2" End Sub Sub beep_me2() Beep Application.OnTime (Now + TimeSerial(0, 0, 0.8)), "beep_me3" End Sub Sub beep_me3() Beep End Sub
🗝️ How Does the Code Work?
At first, we declare a subroutine name Beep_Alarm. Then we declare another variable named beep_at. We assign an InputBox to the beep_at variable. The InputBox will display the words inside inverted commas. Then we take another application named TimeValue. In this application, we call another subroutine named Beep_Me. This beep_me subroutine will eventually call another two subroutines named beep_me2 and beep_me3. These three subroutines will result in three beep sounds when the alarm time will arrive.
- Now, run the code by clicking the Run button on the top or by pressing F5.
- Now, a window will pop up asking for the alarm time. Here you must give the time in 24 hours format.
- After setting the time, guess what? You will hear exactly 3 beeps just at the alarm time.
In this way, we can set the beep sound as an alarm in Excel.
Read More: How to Create Digital Clock in Excel ( 2 Easy Methods)
2. Playing Custom Sound in Excel Alarm Clock
In this method, we will learn how we can set an alarm clock in Excel with a custom sound. To know more, follow the steps below.
- Just like the 1st step, open a new module in Visual Basic Window.
- Now, write down the following code in the module.
'Alarm with Custom Sound #If Win64 Then Private Declare PtrSafe Function Play_Sound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal AA_lpszName As String, _ ByVal AA_Module As LongPtr, ByVal AA_Flags As Long) As Boolean #Else Private Declare Function Play_Sound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal AA_lpszName As String, _ ByVal AA_Module As Long, ByVal AA_Flags As Long) As Boolean #End If Const AA_SND_SYNC = &H0 Const AA_SND_ASYNC = &H1 Const AA_SND_FILENAME = &H20000 Sub CustomSound_Alarm() Dim beepat As String beepat = InputBox("Give Alarm at", "hh:mm:ss " & _ Format(Now, "mm:hh"), "11:30") If beepat = "" Then MsgBox "Terminated" Exit Sub End If Application.OnTime TimeValue(beepat), "AlarmSound2" End Sub Sub AlarmSound2() Call Play_Sound("F:\90_Aniruddah\90_57\alarm1.wav", _ 0, AA_SND_ASYNC Or AA_SND_FILENAME) End Sub
🗝️ How Does the Code Work?
Here, first, we have declared two private functions for two different versions of Windows (Windows 64 and other versions). Then we have declared 3 constants named SND_SYNC, SND_ASYNC and SND_FILENAME. After that, we have taken another subroutine named CustomSound_Alarm. Inside this subroutine, we have declared a variable named beepat Input box. We have taken another application named TimeValue that will call another subroutine named AlarmSound2. The AlarmSound2 will play a local file audio whose location is set as F:\90_Aniruddah\90_57\alarm1.wav. You need to write the location of your File in this position.
- Here in the place of F:\90_Aniruddah\90_57\alarm1.wav, write the location of your sound file. You can do that by copying the file address from Windows File Explorer.
- Now if you run the code by pressing F5, a message box will appear asking for the Alarm time. Here, input the time (in 24 Hours format) and click OK.
- After setting the time, you should hear your own custom sound that you have set at the alarming time.
Read More: How to Create Countdown Timer in Excel (with Easy Steps)
3. Displaying and Reading Out Messages in Excel Alarm Clock
Many times along with setting an alarm, we also need to show a message box during alarm time. In this method, I will show you how to display and read out a message box containing a customized message during alarm time. Sounds interesting? Let’s follow the steps below.
- Just like the 1st and 2nd methods, open the Visual Basic window and insert another New Module.
- Then write down the following code in the module.
' Alarm with Message Sub Reading_Message_Alarm() Dim beepat As String beepat = InputBox("Give Alarm at", "hh:mm:ss " & _ Format(Now, "mm:hh"), "11:30") If beepat = "" Then MsgBox "Terminated" Exit Sub End If Application.OnTime TimeValue(beepat), "DisplayAlarm" End Sub Sub DisplayAlarm() Application.Speech.Speak ("This is the message that will be read out during alarm time.") MsgBox "This is the message that will be displayed in the messagebox" End Sub
🗝️ How Does the Code Work?
In this code, at first, we have taken a subroutine named Reading_Message_Alarm. Then we have taken a variable named beepat. With this variable, we have assigned an InputBox that will ask for the alarm time. Based on the alarm time, an application named TimeValue will call another subroutine named DisplayAlarm. This subroutine will speak the message and display the message as well.
- Now, run the code by pressing the F5. As a result, a window will open up and you need to input the alarm time and press OK.
- Consequently, when the alarm time will arrive, the message will be read out first and then the message box will be displayed like the picture below.
Read More: How to Make a Running Clock in Excel (2 Easy Ways)
Things to Remember
- For playing customized alarm sound, you need to set .wav Please be aware that Mp3 file format may not work in this case.
That is the end of this article regarding setting an Excel alarm clock. If you find this article helpful, please share this with your friends. Moreover, do let us know if you have any further queries. Finally, please visit Exeldemy for more exciting articles on Excel.