+ Reply to Thread
Results 1 to 6 of 6

Get a sound notification in an excel spreadsheet

  1. #1
    Registered User
    Join Date
    03-13-2016
    Location
    casablanca
    MS-Off Ver
    2013
    Posts
    6

    Smile Get a sound notification in an excel spreadsheet

    Hello,

    I really need your urgent help,
    i wonder if there's anyway of playing a sound whenever a specific cell equals a certain value
    This has to happen automatically as the cell updates and require no interaction.
    Any suggestions would be appreciated.

    i've found some VBA codes, but as a beginner i don't know how to use them and i should deliver my work on this week.

    Copy the code below to a VBA module in your workbook.

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

    Function Alarm(Cell, Condition)
    Dim WAVFile As String
    Const SND_ASYNC = &H1
    Const SND_FILENAME = &H20000
    On Error GoTo ErrHandler
    If Evaluate(Cell.Value & Condition) Then
    WAVFile = ThisWorkbook.Path & "\sound.wav" 'Edit this statement
    Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
    Alarm = True
    Exit Function
    End If
    ErrHandler:
    Alarm = False
    End Function

    NOTE: The Alarm function expects a WAV file (named sound.wav) in the same path as the workbook. You will need to change this statement to match the name (and path) of your actual sound file. If the sound file is not found, the default system sound will be used.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Get a sound notification in an excel spreadsheet

    Try pasting this into the Sheet1 tab on the VBA Editor for instance.

    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    03-13-2016
    Location
    casablanca
    MS-Off Ver
    2013
    Posts
    6

    Re: Get a sound notification in an excel spreadsheet

    Hello mrice,

    Thank you so much for your reply

    i will explain what i really need, ( not sure if this can be done )

    there will be a principal sheet, and other sheets that are categorized ( EX: Product 1, Product 2 ...), and each Product sheet contains some item numbers.

    in the principal sheet i will put some item numbers, what i really want is when i past an item number, a sound will say in which category it belongs.

    can this be done ? i would appreaciate your help

  4. #4
    Registered User
    Join Date
    03-13-2016
    Location
    casablanca
    MS-Off Ver
    2013
    Posts
    6

    Re: Get a sound notification in an excel spreadsheet

    anybody can help ?

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Get a sound notification in an excel spreadsheet

    Look at this link to learn about VBA and Sounds.

    http://www.cpearson.com/excel/PlaySound.aspx

    Here is some info on playing MP3 files in VBA

    http://spreadsheetpage.com/index.php...es_from_excel/
    Last edited by alansidman; 03-15-2016 at 05:27 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Registered User
    Join Date
    03-13-2016
    Location
    casablanca
    MS-Off Ver
    2013
    Posts
    6

    Re: Get a sound notification in an excel spreadsheet

    Thank you so much ALANSIDMAN i will take a look on it, but i'm really pressed by time, not sure if i could realize mo project this weekend

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Notification Sound
    By MsBBStacker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2015, 10:11 AM
  2. Replies: 8
    Last Post: 08-31-2013, 03:20 AM
  3. Expiry date notification on Excel spreadsheet
    By Michael321 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-05-2013, 04:46 PM
  4. [SOLVED] How do I create a sound alert in excel spreadsheet
    By shaun t in forum Excel General
    Replies: 10
    Last Post: 10-09-2012, 02:32 PM
  5. Excel Spreadsheet with notification when due date arrives
    By romeoe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2007, 02:00 AM
  6. [SOLVED] excel spreadsheet with e-mail notification when due date arrives
    By karen gomez in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  7. [SOLVED] excel spreadsheet with e-mail notification when due date arrives
    By Ron de Bruin in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM

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