Start MS Word 2007. You can open an existing document or start a new document.
Step 2
The next several steps will be done in the VBA code editor. To open the code editor type Alt-F11 (hold the Alt key down then press the F11 key).
Step 3
Project List - Normal Is Selected
You should see a list of Projects on the left side of this code window. Using your mouse, select Normal if you want TTS available in all of your documents, otherwise select the current document name for TTS in this document only
Step 4
Macro Code
---------------------------------------------------------------------------
Option Explicit
Dim speech As SpVoice
Dim i As Integer
Sub SpeakText()
On Error Resume Next
If i = 0 Then
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
Else
If i = 1 Then
speech.Resume
i = 0
End If
End If
End Sub
Sub StopSpeaking()
On Error Resume Next
speech.Speak vbNullString, SVSFPurgeBeforeSpeak
Set speech = Nothing
i = 0
End Sub
Sub PauseSpeaking()
On Error Resume Next
If i = 0 Then
speech.pause
i = 1
Else
If i = 1 Then
speech.Resume
i = 0
End If
End If
End Sub
------------------------------------------------------------------------------------------------
Next select the Insert > Module menu option. A new blank code window will open. This is where the macro code will go. Here is the code. I hope you can copy and paste, if not the code is not that long to type.
Step 5
Before the code will run you have to add a reference to the Microsoft Speech Object Library. Select the Tools > References... menu option. Scan the list of references and click the little box next the "Microsoft Speech Object library", then click OK.
Step 6
You are finished with the code now, so do a File > Save and return to the main Word screen.
Step 7
In order to conveniently run your macros, you will probably want to add three buttons to the quick access tool bar. You can do this by clicking the small downward arrow with the “Customize quick access toolbar” tooltip on the title bar of MS Word near the Save, Undo and Redo buttons. Select “More commands” in the dropdown menu to open the “Word options” window. Select “Customize” on left hand menu and “Choose commands from” should be set to “Macros”. Add all three macros and this will create three buttons on the quick access tool bar. You can modify the button icons to more closely represent the TTS functions.
Step 8
Now your MS word is TTS enabled. Just click the Start, Pause, or Stop buttons and listen to the lovely Microsoft Anna.
IF THIS WAS HELPFUL PLEASE LEAVE A COMMENT
