ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   playing sound??? (https://www.excelbanter.com/excel-programming/314048-playing-sound.html)

tess457[_6_]

playing sound???
 

is there anyway of playing a sound once a user opens my excel file??
Thanks!

--
tess45
-----------------------------------------------------------------------
tess457's Profile: http://www.excelforum.com/member.php...fo&userid=1393
View this thread: http://www.excelforum.com/showthread.php?threadid=27058


Tom Ogilvy

playing sound???
 
John Walkenbach's site:
http://j-walk.com/ss/excel/tips/tip59.htm
for playing a sound

Chip Pearson's site for information on the Workbook_Open Event

http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy

"tess457" wrote in message
...

is there anyway of playing a sound once a user opens my excel file???
Thanks!!


--
tess457
------------------------------------------------------------------------
tess457's Profile:

http://www.excelforum.com/member.php...o&userid=13938
View this thread: http://www.excelforum.com/showthread...hreadid=270583




ste mac[_2_]

playing sound???
 
Hi Tess457,

Put this code in the workbook open event...

Private Sub Workbook_Open()
PlayWAV
End Sub

This code will play any wav you need as long as the wav is in the
same folder/directory as the workbook... just put it in a module

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

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

Sub PlayWAV()
WAVFile = "yoursound.wav"
WAVFile = ThisWorkbook.Path & "\" & WAVFile
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

and it shouls play your sound file when you open the workbook..

hope this helps...

ste


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

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