Here are my answers for your questions;
a) Here is the code to check the system time:
------------------------
Sub zaman()
Sheets("Sheet1").Range("A1").Value = Hour(Now())
Sheets("Sheet1").Range("B1").Value = Minute(Now())
Sheets("Sheet1").Range("C1").Value = Second(Now())
Nextzaman
End Sub
-------------------------
and here is the code that re-runs the macro at minute intervals:
---------------------------------
Private Sub Nextzaman()
Application.OnTime Now + TimeValue("00:01:00"), "zaman"
End Sub
---------------------------------
b) For Alarm code invoking I tried to do it like this:
'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 - I removed this line from
the original code because I thought that I could do the same control with
the long IF...statement below. I also was not sure if the
"IfEvaluate(Cell.Value & Condition) Then" format will work for two cells (A1
& B1). Couse the original statement format looks like it only accepts "a
numerical cell value" not more...
WAVFile = "D:\Myfolder" & "\sound.wav" ' Original location of my
alarm sound file
If (Sheet1!A1 = 7 And Sheet1!B1 = 55) Or (Sheet1!A1 = 8 And
Sheet1!B1 = 35) Or (Sheet1A1 = 9 And Sheet1!B1 = 15) Or (Sheet1!A1 = 9 And
Sheet1!B1 = 55) Or (Sheet1!A1 = 10 And Sheet1!B1 = 10) Or (Sheet1!A1 = 10
And Sheet1!B1 = 50) Or (Sheet1!A1 = 11 And Sheet1!B1 = 30) Or (Sheet1!A1 =
11 And Sheet1!B1 = 40) Or (Sheet1!A1 = 12 And Sheet1!B1 = 20) And (Sheet1!A1
= 13 And Sheet1!B1 = 0) Then Call PlaySound(WAVFile, 0&, SND_ASYNC Or
SND_FILENAME)
' The long statement above tries to call the alarm sound function depending
upon the conditions
Alarm = True
Exit Function
End If
ErrHandler:
Alarm = False
End Function
---------------------------------------------
Private Sub Workbook_Open()
Application.Run "zaman"
Call Alarm ' I am not sure if there needs to be such an additonal line like
this here. Without this line the "zaman" module works OK.
End Sub
---------------------------------------------
Hope you have a clearer view now for my problem...
Do you think I should have added the "Call Alarm" command into the "Private
Sub Nextzaman()" module rather then "Private Sub Workbook_Open()" ?
Thanks for not giving up on me. I'll be waiting impatiantly for your
solution suggestions
TIA