Making sound with Excel

  • Thread starter Thread starter Grinch
  • Start date Start date
G

Grinch

Can Excel make sound ?

I am ingesting real-time data into excel. When certain criteria are met, I
want the computer to ring an alarm or play a sound file.

How can I do this?

I'm good with Excel and do macros but don't know vba at all.

Thanks,

Grinch
 
Grinch said:
Can Excel make sound ?

I am ingesting real-time data into excel. When certain criteria are met, I
want the computer to ring an alarm or play a sound file.

How can I do this?



Create a new module with the following declaration

Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uflags As Long) As Long

Sub PlayWav1(stWavFileName As String)
sndPlaySound stWavFileName, 0
End Sub



Then insert an IF statement into your macro as below with the C:\My Documents\ExcelSounds\Exclamation.wav being the location of the sound that you wish to play.

If Sheets("Sheet1").Range("A1") = "True" Then
PlayWav1 "C:\My Documents\ExcelSounds\Exclamation.wav"
End If
 
Reo Grande said:
Can Excel make sound ?

I am ingesting real-time data into excel. When certain criteria are met,
I
want the computer to ring an alarm or play a sound file.

How can I do this?



Create a new module with the following declaration

Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uflags As Long) As Long

Sub PlayWav1(stWavFileName As String)
sndPlaySound stWavFileName, 0
End Sub



Then insert an IF statement into your macro as below with the C:\My
Documents\ExcelSounds\Exclamation.wav being the location of the sound that
you wish to play.

If Sheets("Sheet1").Range("A1") = "True" Then
PlayWav1 "C:\My Documents\ExcelSounds\Exclamation.wav"
End If


Thanks, I'll try this.
 
Back
Top