#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Excel Sounds


Does anyone know how to get Excel to make a sound when a certain
condition is true? I want an audible alert for when a certain value is
obtained in a cell.


--
donpauleon
------------------------------------------------------------------------
donpauleon's Profile: http://www.excelforum.com/member.php...o&userid=36732
View this thread: http://www.excelforum.com/showthread...hreadid=564576

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default Excel Sounds

Example follows:-

In a standard code module enter the following:
Const WFile As String = "C:\WINNT\Media\Ringin.Wav"
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

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 As Range, Condition As String) As String
If Not IsNumeric(Cell.Value) Then
Alarm = "Enter a number you idiot !!!"
ElseIf Evaluate(Cell.Value & Condition) Then
Call PlaySound(WFile, 0&, SND_ASYNC Or SND_FILENAME)
Alarm = "Answer the phone !!!"
ElseIf Not Evaluate(Cell.Value & Condition) Then
Alarm = "Get back to work !!!"
End If
End Function

You will likely have to replace the path shown above to the wave file of
your choice. The following line likely needs to be corrected:
Const WFile As String = "C:\WINNT\Media\Ringin.Wav"

In cell B1 enter the formula:
=Alarm(A1, "=100")
Now in cell A1 enter miscellaneous values (numbers or text). The sound
should fire only when you enter the number 100. You can change the criterion
to whatever you like. Enter it in quotes. If you want the sound to fire when
the number is greater than or equal to 10 then enter "=10".

Regards,
Greg



"donpauleon" wrote:


Does anyone know how to get Excel to make a sound when a certain
condition is true? I want an audible alert for when a certain value is
obtained in a cell.


--
donpauleon
------------------------------------------------------------------------
donpauleon's Profile: http://www.excelforum.com/member.php...o&userid=36732
View this thread: http://www.excelforum.com/showthread...hreadid=564576


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default Excel Sounds

BTW, you don't need a worksheet formula to fire the sound. It can be set up
so that the Workseet_Change event fires the sound.

Greg

"Greg Wilson" wrote:

Example follows:-

In a standard code module enter the following:
Const WFile As String = "C:\WINNT\Media\Ringin.Wav"
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

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 As Range, Condition As String) As String
If Not IsNumeric(Cell.Value) Then
Alarm = "Enter a number you idiot !!!"
ElseIf Evaluate(Cell.Value & Condition) Then
Call PlaySound(WFile, 0&, SND_ASYNC Or SND_FILENAME)
Alarm = "Answer the phone !!!"
ElseIf Not Evaluate(Cell.Value & Condition) Then
Alarm = "Get back to work !!!"
End If
End Function

You will likely have to replace the path shown above to the wave file of
your choice. The following line likely needs to be corrected:
Const WFile As String = "C:\WINNT\Media\Ringin.Wav"

In cell B1 enter the formula:
=Alarm(A1, "=100")
Now in cell A1 enter miscellaneous values (numbers or text). The sound
should fire only when you enter the number 100. You can change the criterion
to whatever you like. Enter it in quotes. If you want the sound to fire when
the number is greater than or equal to 10 then enter "=10".

Regards,
Greg



"donpauleon" wrote:


Does anyone know how to get Excel to make a sound when a certain
condition is true? I want an audible alert for when a certain value is
obtained in a cell.


--
donpauleon
------------------------------------------------------------------------
donpauleon's Profile: http://www.excelforum.com/member.php...o&userid=36732
View this thread: http://www.excelforum.com/showthread...hreadid=564576


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Excel 2003 from Windows Explorer pmpjr Excel Discussion (Misc queries) 9 September 11th 06 03:58 PM
excel viewer littlebird0770 Setting up and Configuration of Excel 6 July 6th 06 04:10 PM
Want to make conditional sounds based on cell values in Excel [email protected] New Users to Excel 1 January 25th 06 03:51 PM
Excel Range Value issue (Excel 97 Vs Excel 2003) Keeno Excel Discussion (Misc queries) 2 June 13th 05 02:01 PM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM


All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"