MS Excel play a sound macro question

ExcelFailure

Board Regular
Joined
Mar 6, 2013
Messages
74
Hi,

Im working on Excel 2007 and I have a table of our sales orders that updates automatically on a Microsoft Query. From this I've done a Count formula to tell me how many orders there are for today.

What is was wanting to do is have a sound play, preferably a .wav whenever a new order comes in, or in effect, when the cell with the Count formula in changes. I've tried loads of various macros but they don't seem to work. I may be doing something wrong..can anybody help??

Thanks a lot!
 
I forgot to set the new value;
Rich (BB code):
Private Const m_strPriorCountName As String = "str_PriorCount"
Private Const m_strCountCellRef As String = "A1"

Private Sub Worksheet_Calculate()
    Dim nme As Excel.Name
    Dim rng As Excel.Range

    Set rng = Me.Range(m_strCountCellRef)

    On Error Resume Next
        Set nme = ThisWorkbook.Names(m_strPriorCountName)
    On Error GoTo 0

    If nme Is Nothing Then
        Call ThisWorkbook.Names.Add(Name:=m_strPriorCountName, RefersTo:=rng.Value2, Visible:=False)
        Exit Sub
    End If

    If rng.Value2 > Evaluate(nme.RefersTo) Then
        Call Application.Speech.Speak("Dude, you have a new order!")
    End If
    
    nme.RefersTo = rng.Value2
End Sub
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top