Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Philadelphia, Pennsylvania
    Thanked 0 Times in 0 Posts

    Playing sound during macro (Excel 2000)

    I would like to play a sound when my macro is over, so I don't have to watch the screen. I can watch my co-workers break up. How does one "play" or "run" a sound file? If it's too complicated, I'll pass, but let's see. TYIA

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Playing sound during macro (Excel 2000)

    Put the following declarations in a standard module:

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

    Private Const SND_ASYNC = &H1 ' play asynchronously
    Private Const SND_FILENAME = &H20000 ' name is a file name

    and use them like this in your macro (substitute the path and file name of the sound file you want to play):

    PlaySound "C:WindowsMediaTada.wav", 0, SND_FILENAME Or SND_ASYNC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts