How to Turn on Text to Speech for Word 2007

By Benjamin Aries

Beginning with Microsoft Windows 2000, core Microsoft utilities have had the ability to read written text out loud. This capability, called "Text To Speech," is not included in Word 2007. If you have installed Microsoft Speech Object Library on the computer, however, you can re-enable the speech capability using a special macro code.

Things You'll Need

  • Microsoft Speech Object Library

Add Speech Reference

Step 1

Start the Microsoft Visual Basic Editor from within Word by pressing Alt+F11 keys. Click the "Tools" menu and then select "References." On the list marked "Available References," scroll until "Microsoft Speech Object Library" is selected. Click the check box next to this listing. Click "OK."

Step 2

Add a new module by clicking "Create a New Module" on the Microsoft Visual Basic Editor. Select the "Name" field and enter "TextToSpeech." In the "Macro" command area, paste the following code:Dim speech as SpVoiceSub SpeakText()On Error Resume NextSet speech = New SpVoiceIf Len(Selection.Text) > 1 Then 'speak selection speech.Speak Selection.Text, _ SVSFlagsAsync + SVSFPurgeBeforeSpeakElse 'speak whole document speech.Speak ActiveDocument.Range(0, ActiveDocument.Characters.Count).Text, _ SVSFlagsAsync + SVSFPurgeBeforeSpeakEnd IfDo DoEventsLoop Until speech.WaitUntilDone(10)Set speech = NothingEnd SubSub StopSpeaking()'Based on a macro by Mathew Heikkila'used to interrupt any running speech to textOn Error Resume Nextspeech.Speak vbNullString, SVSFPurgeBeforeSpeakSet speech = NothingEnd Sub

Step 3

Right-click on the Word 2007 toolbar. From the list, select "Customize Quick Access Toolbar." Click "Add Macro" and choose the newly created "TextToSpeech" macro. Click "Add" and then "OK." This toolbar button will now turn text to speech on and off as needed.