Excel Sounds

  • Thread starter Thread starter Pivotrend
  • Start date Start date
P

Pivotrend

hello

how can i make a Cell give a Warning sound (or Flash, Blink) when i
reaches a specific digit
 
Hi Pivotrend!

Here's something from Chip Pearson:

http://www.cpearson.com/excel/excelM.htm#PlayWAV

It is very simple to have your macro code play a WAV file. First, add
a Windows95 API declaration at the top of your code module:

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

Then, call the function, passing it the name of the WAV file you want
to play:

Call sndPlaySound32("c:\test\MySound.WAV", 0)

I put the code at the top of a module and then wrote the following
worksheet_change sub which (as usual) is in the sheet module where the
cell is located.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1") > 6 Then
Call sndPlaySound32("c:\test\MySound.WAV", 0)
End If
End Sub

Sure gets annoying after a time though and I suggest that you ensure
it only happens once!

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
Back
Top