Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

How can I repeat the Speak Cell in intervals, once in two minutes?

0

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!

Answer
Discuss

Answers

0

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.

Discuss

Discussion

Catharsus

What happened with this please.?Was my answer useful or not?
John_Ru (rep: 6142) Nov 16, '20 at 12:06 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login