I have a worksheet including data updating in every minute and render new data. I need excel to Speak Cell repeating the same cell in every two minutes. I could not find any solution to this.
Best!
I have a worksheet including data updating in every minute and render new data. I need excel to Speak Cell repeating the same cell in every two minutes. I could not find any solution to this.
Best!
Assuming you want Excel to convert a cell content to speech every 2 minutes, you can do that based on Don's tutorial here Run a Macro at Set Intervals in Excel
In the attached file, I've just modified Don's code from that to:
1) rename his macro "mymacro" to "Speak_At_Intervals"
2) replace the run command in that macro from MsgBox (now commented out) to
Application.Speech.Speak Cells(3, 3).Text & Cells(3, 4).Text
- this makes Excel say an introductory phrase in cell C3 plus a number in cell D4 (the kind of value I assume your spreadsheet is recaculating)
3) set the "interval" in Sub macro_timer to do that every 2 minutes.
You can run "Speak_At_Intervals" alone, just to see how that works, but to get it to speak every two minutes, run "macro timer"
REVISION (reflected in revised file "Speak cell contents at intervals v0_b.xlsm" attached) : If you have a monetary number to be spoken, Excel will do that if the cell is formatted as currency (but the value will remain a number e.g. 3.27)
Note that you can use Sub stop_macro to stop the repeated speech.
Full code is here:
Public interval As Double
Sub macro_timer()
interval = Now + TimeValue("00:02:00")
'Tells Excel when to next run the macro.
Application.OnTime interval, "Speak_At_Intervals"
End Sub
Sub Speak_At_Intervals()
'Macro code that you want to run.
'MsgBox "This is my sample macro output."
Application.Speech.Speak Cells(3, 3).Text & Cells(3, 4).Text
'Calls the timer macro so it can be run again at the next interval.
Call macro_timer
End Sub
Sub stop_macro()
Application.OnTime Earliesttime:=interval, Procedure:="Speak_At_Intervals", Schedule:=False
End Sub
Not sure if this will work within your updating data file but good luck.