Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hello all, I'm trying to use an alarm function of Excel. Basically, if A9
is equal to a certain value, for example 213, I would like a sound to be played. If not, no sound. I seem to have the coding right for this, but whenever you erase the data in cell A9, the sound plays. Any suggestions? All your help is appreciated!! My code is below. =Alarm(A9,"=213") and the function I used is below 'Windows API function declaration Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Function Alarm(Cell, Condition) Dim WAVFile As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 On Error GoTo ErrHandler If Evaluate(Cell.Value & Condition) Then WAVFile = ThisWorkbook.Path & "\sound.wav" Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) Alarm = True Exit Function End If ErrHandler: Alarm = False End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to add sound ( beep ) if cell content changes in live data | Excel Discussion (Misc queries) | |||
How Do I Recover the Erased Data | Excel Worksheet Functions | |||
CAN EXCELL SOUND AN ALARM ? | Excel Discussion (Misc queries) | |||
Sound on data entry | Excel Discussion (Misc queries) | |||
adding sound to an excel i.e. warning if data is negative | Excel Discussion (Misc queries) |