Home > Software engineering >  [for] VBA word macro Settings
[for] VBA word macro Settings

Time:09-24

Sub SpeakText () On the Error Resume Next Set researched=New SpVoice Selection. MoveLeft Unit:=wdWord, Count:=1 Selection. MoveRight Unit:=wdWord, Count:=1, the Extend:=wdExtend If Len (Selection. The Text) & gt; 1 Then researched. Speak Trim (Selection. The Text), SVSFlagsAsync + SVSFPurgeBeforeSpeak End If Selection. MoveRight Unit:=wdWord, Count:=1 Do DoEvents Loop Until researched. WaitUntilDone (10) Set researched=Nothing End Sub

This macro in the word set some hint compiler error lack: end of the statement,

Great god please help solve, thank you, thank you.

CodePudding user response:

1. Code statement to "end of the line", or use the es colon separated each other code,
2. This Duan Hong code, you need to reference a what what of library, to run,
 Sub SpeakText () 
On the Error Resume Next
The Set researched=New SpVoice
Selection. MoveLeft Unit:=wdWord, Count:=1
Selection. MoveRight Unit:=wdWord, Count:=1, the Extend:=wdExtend
If Len (Selection. The Text) & gt; 1 Then
Researched. Speak Trim (Selection. The Text), SVSFlagsAsync + SVSFPurgeBeforeSpeak
End the If
Selection. MoveRight Unit:=wdWord, Count:=1
Do
DoEvents
Loop Until researched. WaitUntilDone (10)
The Set researched=Nothing
End Sub
  •  Tags:  
  • VBA
  • Related