Adding Text to Speech to Microsoft Word 2007 Tutorial
107.3 هزار بار بازدید -
14 سال پیش
-
In this tutorial I will
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
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
14 سال پیش
در تاریخ 1389/01/20 منتشر شده
است.
107,345
بـار بازدید شده