Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Play Sound File Once when cell value condition id met John 1 Excel Discussion (Misc queries) 4 September 1st 07 04:32 PM
How can I play a .WAV file in Excel if a condition is met? Roy Excel Worksheet Functions 3 April 27th 06 07:24 PM
How can i play a wave file in excel? pj Excel Discussion (Misc queries) 2 November 25th 05 07:36 PM
Macro to Play Wave File yo beee Excel Programming 3 November 3rd 03 02:56 AM
Macro to play wave file yo beee Excel Programming 1 October 29th 03 11:42 PM


All times are GMT +1. The time now is 08:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"