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
Range("A1").Formula = "=if(sheet1!b2=""期中"",""八年级期中考试成绩"",""八年级期期末考试成绩"")"