AbdulKayum
New Member
- Joined
- Apr 21, 2022
- Messages
- 4
- Office Version
- 365
- 2016
- Platform
- Windows
Hi , Please can you help, i would like a running clock with certain time during the day to able to alert with a speach and also to able to have a running scrolling text. I am struggling to able to put all 3 (running clock, Speach speak & Scrolling text working in the same excel workbook) i am trying to build a spreadsheet to show live clock for prayer time timetable, but need a speach during the day 5 times to speak once that he prayer time is due and also on the screen to have a scrolling text running. i have all 3 different VBA coe on this post but i need these working wotking as am struggning to able to run 3 running marcos at once.
This is for Clock to work:
Dim SchedRecalc As Date
Sub Recalc()
With Sheet1.Range("A1")
.Value = Format(Time, "hh:mm:ss AM/PM")
End With
Call SetTime
End Sub
Sub SetTime()
SchedRecalc = Now + TimeValue("00:00:01")
Application.OnTime SchedRecalc, "Recalc"
End Sub
Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False
End Sub
This coding is for the scrolling;
Sub start_Scroll()
myValue = Range("C21").Value
finalval = WorksheetFunction.Rept(myValue, 1)
Do
For i = 1 To Len(finalval)
l = Len(finalval) - 1
DoEvents
For a = l To 500000000#
a = a + l
Next
Range("B36") = Mid(finalval, i, l) & Left(finalval, i - 1)
Next
Loop
End Sub
and this is the last VBA code for speach
Function BEEPNOW(sales As Long) As String
Beep
Message = "TIME FOR NOMAZ"
Application.Speech.Speak Message
BEEPNOW = Message
End Function
This is for Clock to work:
Dim SchedRecalc As Date
Sub Recalc()
With Sheet1.Range("A1")
.Value = Format(Time, "hh:mm:ss AM/PM")
End With
Call SetTime
End Sub
Sub SetTime()
SchedRecalc = Now + TimeValue("00:00:01")
Application.OnTime SchedRecalc, "Recalc"
End Sub
Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False
End Sub
This coding is for the scrolling;
Sub start_Scroll()
myValue = Range("C21").Value
finalval = WorksheetFunction.Rept(myValue, 1)
Do
For i = 1 To Len(finalval)
l = Len(finalval) - 1
DoEvents
For a = l To 500000000#
a = a + l
Next
Range("B36") = Mid(finalval, i, l) & Left(finalval, i - 1)
Next
Loop
End Sub
and this is the last VBA code for speach
Function BEEPNOW(sales As Long) As String
Beep
Message = "TIME FOR NOMAZ"
Application.Speech.Speak Message
BEEPNOW = Message
End Function