Make Excel Read out Messages in Voice Format – Activate Text to Speech(TTS)
To display traditional method of error or information notification, we throw a ‘Message Box’ to User through a tiny pop-up window.To know how to create such notification messages using “Msgbox” command, refer this page which explains how to create your first Hello World VBA Program.
But, these message boxes will pop up at the background if the excel is not active. Chances are there that Users might miss to notice it If they are working on any other applications like IE, Word or Outlook.
If a task requires an urgent attention from User, then we can code our program to give an additional audible speech notification to et quick response.
Make VBA to Speak the Messages
Wouldn’t it be nice if the computer actually speaks up, asks the user for info or notifies him with a voice message? It increases the chances of user responding to the message more quickly. Let’s see, how to make the VBA use the TTS (Text to Speech) service and speak out the messages.
Visual Basic12345678Sub Check_Speach()'Activate Voice Message NotificationApplication.Speech.Speak "Message From VBA Macro"'Read Data from Excel SheetApplication.Speech.Speak Thisworkbook.Sheets(1).Cells(1,1)End Sub
More Tips: Get Logged in User Id with VBA (Excel Macro).
Different Methods in Speech Notifications
Speech.Speak Command – Parameters: Speak Function has 4 parameters. Refer MSDN library for detailed information of all the 4 parameters.
Here we will discuss about the SpeakAsync parameter which we might use it often. See the example below that depicts how SpeakAsync behaves when it is set to True or False.Visual Basic123456789101112Sub Check_Speach()'SpeakAsync is set to False. So, program execution will wait for the speech to complete'and then proceed to next command.Application.Speech.Speak "Wait for Speech to Complete", FalseMsgBox "Wait for Speech to Complete"'SpeakAsync is True. Program execution continues while Speech is in progressApplication.Speech.Speak "Proceed without Waiting for Completion", TrueMsgBox "Display Message While Speech is in Progress"End Sub
In Short, this parameter decides whether the Program execution can continue or it has to wait till Speak Command Reads out the complete message.
Text to Speech (TTS) – Practical Uses:
- Live Updates: If User has any Excel application that constantly refreshes data, like Stock quotes, Sports Score Cards etc., it will be very useful if Excel provides Voice Updates.
- Task Tracker: If any task or Quiz has to be completes with in restricted Time, it will be nice if Excel updates through voice about Time remaining to complete the task.
- Remainder: It will be so handy in remainder services, with Voice assistance.
- Help: In Excel Applications, Voice Assisted help messages will be more helpful than help tips from Message box or Labels.
It is always fun to have more media assisted applications that having the traditional Message box to provide information to the End user. Let’s use this option to get more user satisfaction.
Enable Text To Speech and Make Excel Talk