LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Alarm 2

Excel 2010

I have an earlier post related to this one. I am trying to set-up an audible alarm when a cell has a value greater than 0.

I was using this VBA for my alarm function:

'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_SYNC Or SND_FILENAME)
Alarm = True
Exit Function
End If
ErrHandler:
Alarm = False
End Function

It worked at one time but now I get #NAME? in the cell that I use the function.

Can you help me troubleshoot this error ?

 
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
Alarm Tomas Excel Worksheet Functions 3 November 24th 09 12:15 AM
How to set an alarm in excel... Fuzzy Excel Discussion (Misc queries) 1 February 12th 09 07:39 AM
Recalc Alarm Mike H. Excel Programming 4 August 9th 07 10:31 PM
Alarm Timer Philosophaie Excel Programming 3 July 12th 07 11:57 PM
Alarm Manthony Excel Programming 0 June 6th 06 03:46 PM


All times are GMT +1. The time now is 11:30 PM.

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

About Us

"It's about Microsoft Excel"