ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How play a wav file (https://www.excelbanter.com/excel-programming/295835-how-play-wav-file.html)

Scott

How play a wav file
 
Is there a way to play a wav file, when a user does a
specific action? I've seen some code in the forum, but i
could not get it to work.

Thanks,

Scott

Bob Phillips[_6_]

How play a wav file
 
Hi Scott,

Here is some code to do it

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

Public Function PlayWavFile(WavFile As String) As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function

call it like

PlayWavFile ("C:\Windows\Media\Microsoft Office 2000\Chimes.wav")


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Scott" wrote in message
...
Is there a way to play a wav file, when a user does a
specific action? I've seen some code in the forum, but i
could not get it to work.

Thanks,

Scott




Scott

How play a wav file
 
Bob,

Thanks for the help. Works great!!!

-----Original Message-----
Hi Scott,

Here is some code to do it

Private Declare Function PlaySound Lib "winmm.dll"

Alias "PlaySoundA" _
(ByVal lpszName As String, _
hModule As Long, _
ByVal dwFlags As Long) As Long

Public Function PlayWavFile(WavFile As String) As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function

call it like

PlayWavFile ("C:\Windows\Media\Microsoft Office 2000

\Chimes.wav")


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Scott" wrote in message
...
Is there a way to play a wav file, when a user does a
specific action? I've seen some code in the forum,

but i
could not get it to work.

Thanks,

Scott



.



All times are GMT +1. The time now is 02:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com