Option Explicit
Dim x As SpeechLib.SpVoice
Private Sub Combo1_Click()
Set x.Voice = x.GetVoices.Item(Combo1.ListIndex)
End Sub
Private Sub Command1_Click()
If VBA.Len(VBA.Trim(Text1.Text & "")) > 0 Then
Command1.Enabled = False
x.Speak Text1.Text & "", SVSFlagsAsync
Do Until x.WaitUntilDone(1)
DoEvents
Loop
'Stop
Command1.Enabled = True
End If
End Sub
Private Sub Form_Load()
Text1.Text = "Hello World!"
Set x = New SpeechLib.SpVoice
Dim i As Long
For i = 0 To x.GetVoices.Count - 1
Combo1.AddItem x.GetVoices.Item(i).GetDescription
Next i
Combo1.ListIndex = 0
End Sub
Dim x As SpeechLib.SpVoice
Private Sub Combo1_Click()
Set x.Voice = x.GetVoices.Item(Combo1.ListIndex)
End Sub
Private Sub Command1_Click()
If VBA.Len(VBA.Trim(Text1.Text & "")) > 0 Then
Command1.Enabled = False
x.Speak Text1.Text & "", SVSFlagsAsync
Do Until x.WaitUntilDone(1)
DoEvents
Loop
'Stop
Command1.Enabled = True
End If
End Sub
Private Sub Form_Load()
Text1.Text = "Hello World!"
Set x = New SpeechLib.SpVoice
Dim i As Long
For i = 0 To x.GetVoices.Count - 1
Combo1.AddItem x.GetVoices.Item(i).GetDescription
Next i
Combo1.ListIndex = 0
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货