View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ste mac[_2_] ste mac[_2_] is offline
external usenet poster
 
Posts: 4
Default 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