Thursday, September 17, 2015

Awesome VBA code to make excel talk !!!

Text to Speech is built into MS Office products from version XP on-wards. There are options to make Excel read cells.

Certainly, MS Excel can talk. MS Excel text to speech speaks in computer voice, which is close to a female voice.



How can we make use of it?

I recommend with a custom function, which simply reads the content of the cell. The voice recognition is quite good for numbers, but for words some improvement is still required.  Also you can make use of this text to speech code in your VBA automation for messaging purpose.


Here comes the user defined function, which you should put inside of a new VBA module:

Function ExcelTalkToMe(strInput) As String

' Author: Dreams24
' Written for VBA Tricks and tips blog
' https://vbatricksntips.com

     Dim strText As String
     strText = "Excel is talking with you..."
     Application.Speech.Speak strInput, True
     ExcelTalkToMe= strText
End Function

No comments: