View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Homey Homey is offline
external usenet poster
 
Posts: 143
Default Need macro to play sound in Excel 2007

maybe better not use shell

Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Sub SoundWarning()
sndPlaySound32 "c:\windows\media\tada.wav", 0
End Sub

"AL" wrote in message
...
| Thanks for responding. Unless I did something wrong, this did not work.
I
| created a form with a single button. The button click performed your
| recommended code. I replaced "destiny.wav" with my own wav file but it
still
| did not work. Again, thanks.
|
| AL
|
|
|
| "Gary''s Student" wrote:
|
| Assign the button to something like:
|
| Sub Macro1()
| x = Shell("cmd.exe /c C:\destiny.wav", 1)
| End Sub
| --
| Gary''s Student - gsnu200848
|
|
| "AL" wrote:
|
| When a user button is pushed, how to I play a sound clip (like a wav
file)?