ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need macro to play sound in Excel 2007 (https://www.excelbanter.com/excel-programming/427313-need-macro-play-sound-excel-2007-a.html)

al

Need macro to play sound in Excel 2007
 
When a user button is pushed, how to I play a sound clip (like a wav file)?

Gary''s Student

Need macro to play sound in Excel 2007
 
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)?


al

Need macro to play sound in Excel 2007
 
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)?


Gary''s Student

Need macro to play sound in Excel 2007
 
Be sure the .wav is in C:\
--
Gary''s Student - gsnu200848


"AL" wrote:

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)?


Homey

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)?


al

Need macro to play sound in Excel 2007
 
Homey:
That worked. Thank you for sharing.

AL



"Homey" wrote:

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)?




All times are GMT +1. The time now is 07:36 PM.

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