View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Adding Sound to Program Revisited

Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

Sub PlayWAV()
WavFile = "chimes.wav"
WavFile = "C:\WINDOWS\Media\chimes.wav"
Call PlaySound(WavFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Private Sub Worksheet_Calculate()
Static prevValue
If Range("I1").Value prevValue Then
prevValue = Range("I1").Value
PlayWav
End If
End Sub

The end result is that your sheet module should look the same as if you
copied all the above code and pasted it into an empty sheet module


--
Regards,
Tom Ogilvy


"Carlton Patterson" wrote in message
...
OK,

I'm trying to sort this out myself but still need your help.

I downloaded the following program:

Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

Sub PlayWAV()
WavFile = "chimes.wav"
WavFile = "C:\WINDOWS\Media\chimes.wav"
Call PlaySound(WavFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub


Can someone please help me incorporate the above into;

Private Sub Worksheet_Calculate()
Static prevValue
If Range("I1").Value prevValue Then
prevValue = Range("I1").Value
End If
End Sub


Cheers

Carlton

*** Sent via Developersdex http://www.developersdex.com ***