Adding Text to Speech to Microsoft Word 2007 Tutorial

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
15,533
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 9, 2010

In this tutorial I will use the TTS feature we are adding to Word 2007 to teach you how to add TTS to Word 2007. Because Youtube video descriptions do not allow "Greater than symbols the greater than symbol in the code below has been replace with #. When you copy and paste it into the macro as instructed by the video make sure you replace the # with the "greater than" symbol or SHIFT+.



Option Explicit
Dim speech As SpVoice
Dim i As Integer

Sub startTTS()
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 stopTTS()
On Error Resume Next
speech.Speak vbNullString, SVSFPurgeBeforeSpeak
Set speech = Nothing
i = 0
End Sub

Sub pauseTTS()
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

  • likes, 3 dislikes

Link to this comment:

Share to:
see all

All Comments (36)

Sign In or Sign Up now to post a comment!
  • lol you su---. Just drops off for speaking. lol Darn you messed up voice issues. :) I wonder if you can get any patches.

  • got it work excellent

  • any way to get all the code in one file?

  • mine says sintax error any help?

  • It worked.....woot! super stoked!

  • I've tried this on Office 2010 and it works. (I know, there is a speak button available but there is no pause button). As was said before remember to delete the underlines signs and to put [speech.Speak ActiveDocument.Range(0, ActiveDocument.Characters.Coun­t).Text, SVSFlagsAsync + SVSFPurgeBeforeSpeak] in one single line (without the [ ] ) and everithing works fine.

  • It worked. Thanks a bunch! FYI - the StartTTS Macro needs an extra "End If" at the end; so it has two "End If"'s overall. I.e.: Sub startTTS() 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.Coun­t).Text, SVSFlagsAsync + SVSFPurgeBeforeSpeak End If End If End Sub
  • frm were do you get the text in 3:34? pls reply

  • I need help. it says compile error then highlights " speech.Speak ActiveDocument.Range(0, _ ActiveDocument.Characters.Coun­t).Text, _ SVSFlagsAsync + SVSFPurgeBeforeSpeak" (quotes were not included in the highlighted part.) did i copy it worng or something?

    please help

  • It worked. It really worked. It did take some fooling around with it, probably more like and hour but I finally got it to work.

    Thank you, Thank you, Thank you :o)

    I'm an author and just bought a new computer. I use this feature of MS Word every single day and I'm glad I don't have to upgrade to MS 2010 just to use it.

    You Rock :o)

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more