I am trying to use the Speech Object library SAPI.DLL. I have a routine that lists the available voices the system finds and debug prints the name and a sample is spoken. When I run it only two voices are found. However when I go to WIndows narrator which I believe is the underlying speech object that actually "speaks", I have five separate voices installed. One of these is for a non-English language and I would like to be able to have my VBA change languages and voices. So I could do something like "The word XYZ in English is pronounced ABC in language whatever." So before I can even attempt this, I need to figure out how to get VBA to recognize all the voices I have installed. Thanks for any comments or any good references..
Sub AvailableVoices()
Dim i As Long
Dim voc As SpeechLib.SpVoice
Set voc = New SpVoice
Debug.Print voc.GetVoices.Count & " available voices:"
For i = 0 To voc.GetVoices.Count - 1
Set voc.Voice = voc.GetVoices.Item(i)
Debug.Print " " & i & " - " & voc.Voice.GetDescription
voc.Speak "test audio"
Next i
End Sub
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
Bookmarks