Word 2007 Speechless

Yet another “benefit” or “upgrading” to Word 2007 is the loss of the text-to-speech function inlcuded in earlier versions – I used to use this to read a Word document from one screen so that I could look for differences in a document or web page on another screen.

I found this out after waiting a little while for the Word Help [sic] window to finally open. It says:

“Text-to-speech features are included only in Microsoft Office Excel.”

Why? Well clearly Microsoft want us all to “upgrade” to Windows Vista, their operating system that would insist on my replacing a previously high end sound card with a new one just because there are no Vista drivers for it. Why the hell should I?

You think I’m kidding? No:

“Speech recognition features are not available in the 2007 Microsoft Office system programs.

“To use speech recognition features, run Windows Speech Recognition in Windows Vista.”

Or not. Helpfully, Microsoft also say:

“If your operating system is Microsoft Windows XP, you must run a previous version of a Microsoft Office system program to use speech recognition features.”

Now they tell us…

There is, however, a workaround. From within Word start the VBA Editor  by pressing Alt+F11.

Add a reference in the normal project to Microsoft Speech Object Library (Tools | References…).

Locate the “Microsoft Speech Object Library” reference and add a tick to the check box.

Note: You must have installed the Speech portion of Excel for the Microsoft Speech Object Library to be available to the VBA editor.

Create a new module by right-clicking the Modules element in the tree under the Normal project and clicking Insert | Module. Call it TextToSpeech in the module’s properties box (where it will say Module1 or whatever next to “(Name)”).

Copy and paste the following macro code into the module you have created, save and close the macro editor.

Dim speech as SpVoice 'Don't overlook this line!

Sub SpeakText()
'Based on a macro by Mathew Heikkila
'
On Error Resume Next
Set speech = New SpVoice
If Len(Selection.Text) > 1 Then 'speak selection
speech.Speak Selection.Text, _
SVSFlagsAsync + SVSFPurgeBeforeSpeak
Else 'speak whole document
speech.Speak ActiveDocument.Range(0, ActiveDocument.Characters.Count).Text, _
SVSFlagsAsync + SVSFPurgeBeforeSpeak
End If
Do
DoEvents
Loop Until speech.WaitUntilDone(10)
Set speech = Nothing
End Sub
Sub StopSpeaking()
'Based on a macro by Mathew Heikkila
'used to interrupt any running speech to text
On Error Resume Next
speech.Speak vbNullString, SVSFPurgeBeforeSpeak
Set speech = Nothing
End Sub

Now add this to your Quick Access Toolbar by clicking the down arrow at the end of the QAT | Customize Quick Access Toolbar | More Commands | Choose commands from: and select Macros from the drop-down list | Add | OK.

To use the macro, select a block of text to be read out to you and click the Macro in your QAT (or else it will read the whole shebang as I must confess the stop macro didn’t work for me…).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.