Play Sound

  • Thread starter Thread starter Owen
  • Start date Start date
O

Owen

Hi

Does anybody know how to get a form to play a sound when the recipient opens
a specific form.

Thanks for any advice.

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

then

If Application.CanPlaySounds Then
Call sndPlaySound32("pathname_of_wavfile_to_be_played", 0)

This works in a macro in excel it might work for you too
 
Sparkle

Thanks for the reply. I thought it may be simpler as I am not a great
programmer and the code you have sent doesn't make much sense.

Thanks

Owen
 
Just cut and paste the two bits into your macro or vbscript. The all you
have to do is put the correct path to the sound file. NB The sound file
needs to be a .wav file
 
Hi Sparkle

Followed your advice and just get compiler errors.

Only comments can appear after end sub, end function or end property.

Thnak for your help

Owen
 
Back
Top