+ Reply to Thread
Results 1 to 23 of 23

Just trying to Beep..

  1. #1
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Just trying to Beep..

    I'm trying to get excel to Beep on condition (then eventually play a sound file)

    But I cant even get excel 2007 to do a simple beep

    I right click my sheet, view code:

    Function beepNow()
    beep
    End Function

    Then in my excel sheet, I put something like :::: IF(A1 < 5, beepNow(),"")

    Is this correct?
    For some reason, I see "Beep" (instead of "beep") on all the tutorials, but excel refuses to let me use Beep and keeps changing it to lowercase.

    Thanks for the help.

    [edit]: the error the cell gives is "#NAME?"
    Last edited by ballz; 09-16-2011 at 03:14 PM.

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    Make the function public:
    Please Login or Register  to view this content.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Just trying to Beep..

    hi,

    Please Login or Register  to view this content.
    works fine
    and for example =IF(G11=5;beepnow();"") too

    BR
    MaczaQ

  4. #4
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    Weird, It still doesn't work for me

    I tried making it public. Still #NAME?

    I tried using semicolons ; . Got a syntax error.

    Does my excel not have beep?

    [edit:] am I putting it the right place? right click sheet, view code and just type it in there
    [edit2] it seems like excel cant find my function beepNow
    Last edited by ballz; 09-16-2011 at 03:32 PM.

  5. #5
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    Does your computer beep on boot? If not, the internal speaker may either be disconnected or else is not working. Also, check to make sure your system volume is turned on.

  6. #6
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    If I click on the volume slider, I can hear the "sample beep" of how loud the volume is.

    I'm guessing that the beep is working then.

  7. #7
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    I was messing around with options and enabled "feedback with sound"

    it said I needed to install the Microsoft Office Sounds add-in. Does this have anything to do with it?

  8. #8
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    Going out on a limb here... make sure your calculations are set to automatic. Merely reentering the formula will be enough to get it to calculate for that cell, so it shouldn't matter, but let's double check.

  9. #9
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Just trying to Beep..

    or as an option
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  10. #10
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    I don't have that option checked, but it beeps for me. I doubt that has anything to do with it since the Beep function is deep in your machine and runs at boot during the POST operation. Shouldn't matter.

  11. #11
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    Yup, set to automatic.

    I did a "show calculation steps" (for debugging) and it gives:

    IF(TRUE, beepNow(),")
    IF(TRUE,#NAME?(),"")
    IF(TRUE,#NAME?,"")
    #NAME?

    I think there's something wrong with my function declaration or something.

  12. #12
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    Make sure it's in an ordinary code module. Copy all code to the clipboard. From your visual basic editor, click insert|module, then paste.

  13. #13
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    Done. Didn't work.

    I had it as an Excel object in the first place.

    Now I did the Insert, Module, and I can see a new folder called Modules created in the VBA project window.

    I cleared everything and have this code in Module1
    Public Function BeepNow()
    Beep

    End Function

    Gives #NAME? error still

    Do I need to enable macros or anything like that. I did save it as a macro enabled spreadsheet

  14. #14
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    ok, weirdly

    my function is called BeepNow()

    in my cell it's called beepNow(). And it wont let me change it to uppercase.

    [edit:] changed my code to beepNow() and it still doesn't work. I dont know why excel wont let me save the change to BeepNow()

  15. #15
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    Bingo. I just tried that with macros disabled and immediately got the #Name? error.

  16. #16
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    Also, you may have to recreate the book since saving, closing, reopening has no effect - you'll still get the error. Shut down Excel, start a new session, then recreate the function. Make sure macros are enabled before you do this.

  17. #17
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    AWESOME

    Alright, yeah it was the macro thing.

    I closed and reopened it, and got the Macro warning dialogue and enabled.

    How do I enable macros without having to reopen excel?

  18. #18
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..


  19. #19
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    I did do a search before I asked

    but the trust settings don't really do much (like enable macros). It just has to options to notify if there are macros, disable macros except digitally signed macros, etc.

    I looked elsewhere, seems like the only way to enable is to close and reopen it.

  20. #20
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    That is the case. Once a book is opened, enabling the macro won't do any good from the trust center. If you make that setting change with the book closed, it should work. Is it working for you now?

    Cheers!
    Tom

  21. #21
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    It is working perfectly now.

    Thanks a bunch Tom.

    Now it's time to get it to play a soundfile.

  22. #22
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Just trying to Beep..

    See if this helps (untested):
    Please Login or Register  to view this content.
    You'll need to play with the WAVFile reference to make sure the file exists, and you'll want to confirm it's saved in the same location as your workbook...

  23. #23
    Registered User
    Join Date
    09-07-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Just trying to Beep..

    For others, I used this code::

    Please Login or Register  to view this content.
    and this is called by something like this: =Alarm(A1, ">100")

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1