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 Playing a WAV file in Excel 2002

Also worked unchanged in

Windows 98 SE
Excel 97

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Best I can tell you is that this worked fine for me:

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 = "Noise-2.wav"
WAVFile = "C:\WINDOWS\MEDIA\Chimes.wav"
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Windows XP Professional
Excel 2003

--
Regards,
Tom Ogilvy

"chalky" wrote in
message ...

I have managed to procure a laptop wherre this macro looks like it will
work fine. The formula used is as follows:

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 = "Noise-2.wav"
WAVFile = ThisWorkbook.Path & "\" & WAVFile
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

However, when i run it i get the following error:

run-time error '453'

Can't find DLL entry point playsounda in winmm.dll

Any ideas?


--
chalky
------------------------------------------------------------------------
chalky's Profile:

http://www.excelforum.com/member.php...o&userid=23758
View this thread:

http://www.excelforum.com/showthread...hreadid=504003