Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default audible alarm macros


I have an excel spreadsheet that needs to have an audible alarm soun
when a condition is met. Right now I just use the conditiona
formatting button to have it change to a color. How do I add
macro(and do you have a sample macro) so it makes an audible alarm
Thanks in advance.

Dave



--
dkoc
-----------------------------------------------------------------------
dkoco's Profile:
http://www.excelforum.com/member.php...fo&userid=1668
View this thread: http://www.excelforum.com/showthread.php?threadid=31896

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default audible alarm macros

You use just Beep command to generated a Computer Beep.
Or you can use Shell command to play a sound file.
Below example plays reminder.wav file using Windows Media Player.
, it is assumed that reminder.wav file is in directly in C: drive.

Dim palySound
playSound = Shell("C:\Program Files\Windows Media Player\wmplayer.exe
c:\reminder.wav", vbHide)

Sharad

"dkoco" wrote in message
...

I have an excel spreadsheet that needs to have an audible alarm sound
when a condition is met. Right now I just use the conditional
formatting button to have it change to a color. How do I add a
macro(and do you have a sample macro) so it makes an audible alarm.
Thanks in advance.

Dave




--
dkoco
------------------------------------------------------------------------
dkoco's Profile:
http://www.excelforum.com/member.php...o&userid=16687
View this thread: http://www.excelforum.com/showthread...hreadid=318961



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default audible alarm macros


I'm a newbie so help me out. My spreadsheet is very simple(no vba). Ho
do I add the alarm macro? I have a cell that uses conditiona
formatting to turn it a color. How do I make a sound/alarm also? I ow
a trading company and may need a programmer/developer. Please email m
at with answers. There is a possible jo
opportunity also.

Dav

--
dkoc
-----------------------------------------------------------------------
dkoco's Profile:
http://www.excelforum.com/member.php...fo&userid=1668
View this thread: http://www.excelforum.com/showthread.php?threadid=31896

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default audible alarm macros


can't remember from where I picked this up, but here it is. In a ne
module paste the code below

'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 & "\phone.wav" 'Edit thi
statement
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
Alarm = True
Exit Function
End If
ErrHandler:
Alarm = False
End Function


Then you can call the function in a cell as follows:
=Alarm(A1,0)

where A1 is the cell for which you want to keep an alarm and 0 (coul
be anything else) is the condition you want to keep.

- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=31896

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default audible alarm macros

Here's a clunky way.
I say clunky cause I don't really like bells and whistles in Excel. This
rates around the same as blinking cells for me.


A user defined Function.
Put this in a code module.

'---
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Public Function PlayWavFileIF(WavFile As String, Condition As Boolean) As
Boolean
Const SND_ASYNC = &H1, SND_FILENAME = &H20000
If Condition Then PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFileIF = Condition
End Function

'---

Then you can use it like a cell formula.
So in A1:
=PlayWavFileIF("C:\WINDOWS\Media\tada.wav", B1=1)
Then the audio only plays if B1 is equal to 1

In a conditional format, it works similar:
Condition 1: FormulaIs: =PlayWavFileIF("C:\WINDOWS\Media\tada.wav", B1=1)


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"dkoco" wrote in message
...

I'm a newbie so help me out. My spreadsheet is very simple(no vba). How
do I add the alarm macro? I have a cell that uses conditional
formatting to turn it a color. How do I make a sound/alarm also? I own
a trading company and may need a programmer/developer. Please email me
at with answers. There is a possible job
opportunity also.

Dave


--
dkoco
------------------------------------------------------------------------
dkoco's Profile:
http://www.excelforum.com/member.php...o&userid=16687
View this thread: http://www.excelforum.com/showthread...hreadid=318961





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default audible alarm macros


Rob,

Thanks for your help. I am attaching a very small exce
spreadsheet(only has 3 cells). What I am trying to do is sound an alar
when column 4 is equal to 11. If you could attach your clip in a v
macro(something I dont know how to do yet..learing quick though). Th
numbers 5 and 6 will be changing all the time on my big spreadsheet(it
a trading system). Thanks again for all your help.

Dave

here is small spreadsheet:its simply adding cell 1 and 2.

cell 1 cell 2 cell 3
5 6 1

--
dkoc
-----------------------------------------------------------------------
dkoco's Profile: http://www.excelforum.com/member.php...fo&userid=1668
View this thread: http://www.excelforum.com/showthread.php?threadid=31896

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default audible alarm macros


davetrades@yahoo. com is my email


--
dkoco
------------------------------------------------------------------------
dkoco's Profile: http://www.excelforum.com/member.php...o&userid=16687
View this thread: http://www.excelforum.com/showthread...hreadid=318961

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default audible alarm macros

Assuming Cell 1 is A1 and Cell 2 is B1, Cell 3 will contain a formula:
=A1+B1
D1 will contain this formula: =PlayWavFileIF("C:\WINDOWS\Media\tada.wav",
C1=11)

To insert the code in the workbook:

From the Excel menu: Tools | Macro | Visual Basic Editor
(or use the shortcut Alt+F11)

From the VB menu: Insert | Module
Copy that code in.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"dkoco" wrote in message
...

Rob,

Thanks for your help. I am attaching a very small excel
spreadsheet(only has 3 cells). What I am trying to do is sound an alarm
when column 4 is equal to 11. If you could attach your clip in a vb
macro(something I dont know how to do yet..learing quick though). The
numbers 5 and 6 will be changing all the time on my big spreadsheet(its
a trading system). Thanks again for all your help.

Dave

here is small spreadsheet:its simply adding cell 1 and 2.

cell 1 cell 2 cell 3
5 6 11


--
dkoco
------------------------------------------------------------------------
dkoco's Profile:
http://www.excelforum.com/member.php...o&userid=16687
View this thread: http://www.excelforum.com/showthread...hreadid=318961



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default audible alarm macros


dkoco,

I hope your query was resolved. saw your message today morning.

- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=31896

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
How can I set an alarm Excel? Annell Excel Discussion (Misc queries) 2 January 14th 10 11:31 PM
Alarm Tomas Excel Worksheet Functions 3 November 24th 09 12:15 AM
FLASH ALARM osama amer Excel Discussion (Misc queries) 1 August 28th 06 12:10 PM
Sound / Audible Alert in a Woksheet ? carl Excel Worksheet Functions 3 July 7th 05 09:17 PM
Adding an Audible Alert To A Worksheet carl Excel Worksheet Functions 0 July 5th 05 08:27 PM


All times are GMT +1. The time now is 08:57 AM.

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"