Home » excel » Excel VBA Application.Speech.Speak method: reading numbers as thousands

Excel VBA Application.Speech.Speak method: reading numbers as thousands

Posted by: admin April 23, 2020 Leave a comment

Questions:

(Using Excel 2013)

With Speak Cells on Enter toggled on in a workbook, the behaviour of the text-to-speech seems to be this:

With numbers formatted as General, when you input 1245 it will read the cell as “Twelve Forty-Five”. If you input 1,245 it will read it as “One Thousand Two Hundred Forty-Five” AND change the Cell Format to Number with Use 1000 Separator (,) ticked.

(If you format the cell as Number AND clear the Use 1000 Separator (,) tick box, Speak Cells on Enter reads back “Twelve Forty-Five. If Decimal places is 1 or greater in the Format Cells dialogue, Speak Cells on Enter reads it as “One Thousand Two Hundred Forty-Five Point Zero” (for one decimal place, for instance.)

However, if you use Application.Speech.Speak Range("A1") (with 1,245 entered into A1) it will read back “Twelve Forty-Five” regardless of the fact that it’s got a comma and is in fact formatted as a number.

Once you get to 5 digits both Speak Cells on Enter and Application.Speech.Speak Range("A1") read the value in thousands (i.e. “Ten Thousand) regardless of whether or not the cell is General or Number.

Does anyone know any way to make Application.Speech.Speak read numbers less than 10,000 as thousands easily, or would you need to do a workaround parsing the numbers into words and then reading out that result?

Thanks in advance.

How to&Answers:

Another excellent question. This works for me:

Application.Speech.Speak(Format(Range("A1"),"#,##0"))

Answer:

Sub Numb()
If Selection < 10000 Then Application.Speech.Speak Selection
End Sub

or

Sub ReadTheNumber()
If Range("A1") < 10000 Then Application.Speech.Speak Selection
End Sub