Results 1 to 19 of 19

Thread: System beep

  1. #1

    System beep

    After my code is done I want it to run a system beep. How can I do this?

  2. #2
    The VBA comand for making the beep sound is


    It will sound just one beep so if you want more you need to repeat the line of code or put it in a loop.

  3. #3
    I put beep in but it doesn't make a sound? And I don't have it on mute and I can hear other sounds.


  4. #4
    Daniel, it works for me, although it is very difficult to get it to beep more than once.
    You may need to turn the sound up higher to hear it.

  5. #5
    lol I have the sound up all the way right now. lol

  6. #6
    I just tried this code on another computer and it didn't work either? have any idea why?

  7. #7
    I tried to get Beep to work on 3 different computers, and I never heard anything. What I really need is a sound that goes "phffft!".

  8. #8
    I just thought of something. Maybe you can get the speech facility to help you. Look into it ... it's really kinda cool.

  9. #9
    Since, the system beep won't work can someone help me to get it to make any sound? I just want it to make a noise when it is done.

  10. #10
    Moderator VBAX Wizard lucas's Avatar
    Jun 2004
    Tulsa, Oklahoma
    How about using a .wav file?
    Option Explicit 
     'API Class to take care of playing the file
    Public Declare Function sndPlaySound32 Lib "winmm.dll" _ 
    Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _ 
    ByVal uFlags As Long) As Long 
    Sub VBASound() 
         'Call Api to play LoadIt.wav witch is in the same folder as
         'the active document!
        Call sndPlaySound32(ActiveWorkbook.Path & "\LoadIt.WAV", 0) 
    End Sub 
    Formatting tags added by mark007
    I think this is a kb entry from some time ago.
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  11. #11
    Or you can put the following statement at the end of your code:
    Formatting tags added by mark007

  12. #12
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    May 2004
    For sound see here

    Hi Steve,
    DRJ did the Sound KB
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.

    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  13. #13
    I have just had a thought, the guys that can't get the sound to work, what References have you got ticked in the reference library?

  14. #14
    What reference should I have that I might not have??

    P.S. I can use the text to speech feature OK.

  15. #15
    I have the following ticked
    Visual Basic For Applications - (Which I assume you must have)
    Microsoft Excel 10.0 Object Library
    OLE Automation
    Microsoft Office 10.0 Object Library

  16. #16
    Also for Beep, you need to make sure that you have a sound assigned for Default Beep in the Sounds & Multimedia (this is what it's called in Windows 2000, not sure about XP) Control Panel.

  17. #17
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Jul 2005
    Florida baby!
    Quote Originally Posted by OBP
    Daniel, it works for me, although it is very difficult to get it to beep more than once.
    Sub test() 
        Application.Wait Now + TimeValue("00:00:01") 
    End Sub 
    Formatting tags added by mark007
    And the sound works for me...

    Windows XP
    Excel 2003

    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  18. #18
    Quote Originally Posted by Djblois
    I put beep in but it doesn't make a sound? And I don't have it on mute and I can hear other sounds.

    I think system admins can turn sounds off for computers, which may affect whether or not you can hear the beep. I can hear sounds on my PC, evidenced by this macro:

    Sub Sound() 
        If Application.CanPlaySounds = False Then 
            MsgBox "Your computer cannot play sounds" 
            MsgBox "Your computer can play sounds" 
        End If 
    Formatting tags added by mark007
    hope this helps
    Last edited by compariniaa; 07-17-2006 at 03:33 PM.

  19. #19
    Yes, that is not to be forgotten. I recently was trying to use an API to play a WAV sound, and it kept failing. I added:
    Application.EnableSound = True
    and ...Voila!.. it worked!

Posting Permissions

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