mewingpants
New Member
- Joined
- Apr 1, 2019
- Messages
- 12
Just had a question that I googled and searched this forum and every where else but could not find a solution anywhere.
So I am using this code to help me play a .wav file
I then use this code to play the .wav file if E15 is greater than 146772
This all works great, when E15 is greater than 146772 the .wav plays as it should but I would just like to add a button to "Acknowledge" the alarm and stop the siren sound from playing, if possible.
It is not set on loop but it is a long siren sound and it will go away after 15 seconds but I just wanted to add a "ack" button so whoever puts in a value that's to high must push the 'ack' button. This way they are completely aware of why the alarm is going off.
Sorry if this question was already asked but I couldn't find anywhere this particular set up.
So I am using this code to help me play a .wav file
Code:
#If Win64 Then
Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As LongPtr, ByVal dwFlags As Long) As Boolean
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else]#Else[/URL]
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Boolean
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End]#End[/URL] If
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Function SoundMe() As String
'Updateby Extendoffice 20161223
Call PlaySound("siren.wav", _
0, SND_ASYNC Or SND_FILENAME)
SoundMe = ""
End Function
I then use this code to play the .wav file if E15 is greater than 146772
Code:
=IF(E15>146772,SoundMe(),"")
This all works great, when E15 is greater than 146772 the .wav plays as it should but I would just like to add a button to "Acknowledge" the alarm and stop the siren sound from playing, if possible.
It is not set on loop but it is a long siren sound and it will go away after 15 seconds but I just wanted to add a "ack" button so whoever puts in a value that's to high must push the 'ack' button. This way they are completely aware of why the alarm is going off.
Sorry if this question was already asked but I couldn't find anywhere this particular set up.