View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default calling sounds in VBA for Excel2003

You can give this a try...

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

Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal
dwDuration _
As Long) As Long

Public Sub PlayMe()
PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav"
End Sub

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
--
HTH...

Jim Thomlinson


"JLGWhiz" wrote:

Based on what I can glean from other threads, it seems that I could not call
the tada.wav using VBA code in Excel 2003. If this is not true, what is the
code. I have tried the XL2000 code and it did not work. Thanks.