Sub SpeakText() On Error Resume Next Set speech = New SpVoice Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend If Len(Selection.Text) > 1 Then speech.Speak Trim(Selection.Text), SVSFlagsAsync + SVSFPurgeBeforeSpeak End If Selection.MoveRight Unit:=wdWord, Count:=1 Do DoEvents Loop Until speech.WaitUntilDone(10) Set speech = Nothing End Sub这个在word 中的宏设置部分提示 编译错误 缺少:语句结束。请各位大神帮忙解决,谢谢,谢谢。
第2. 你这段宏代码,需要引用一个什么什么的语音库,才能运行。
Sub SpeakText()
On Error Resume Next
Set speech = New SpVoice
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
If Len(Selection.Text) > 1 Then
speech.Speak Trim(Selection.Text), SVSFlagsAsync + SVSFPurgeBeforeSpeak
End If
Selection.MoveRight Unit:=wdWord, Count:=1
Do
DoEvents
Loop Until speech.WaitUntilDone(10)
Set speech = Nothing
End Sub