Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Play sound
How do I play a sound when I press a commandbutton.
The sound file is on my desktop. -- aac |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Play sound
Something like this should do it... Add a command button from the Control
toolbox and pste this code in the sheet (right click the sheet tab and select view code)... 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 Private Sub CommandButton1_Click() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub -- HTH... Jim Thomlinson "aac" wrote: How do I play a sound when I press a commandbutton. The sound file is on my desktop. -- aac |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Play sound
Thanks Jim,
It works great -- aac "Jim Thomlinson" wrote: Something like this should do it... Add a command button from the Control toolbox and pste this code in the sheet (right click the sheet tab and select view code)... 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 Private Sub CommandButton1_Click() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub -- HTH... Jim Thomlinson "aac" wrote: How do I play a sound when I press a commandbutton. The sound file is on my desktop. -- aac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
animated gif won't play | Excel Discussion (Misc queries) | |||
Play Sound File Once when cell value condition id met | Excel Discussion (Misc queries) | |||
play sound when pressing commandbutton | Excel Discussion (Misc queries) | |||
Go to and play | Excel Discussion (Misc queries) | |||
Can you auto-trigger a sound file to play when a worksheet opens? | Excel Worksheet Functions |