How do you access SAPI Voices other than the default

ynot8669
ynot8669 used Ask the Experts™
on
I have a routine to convert text to speech within acess 2010 running on Windows 7. It works fine.

But, are there other voices supplied in Windows 7 and how would use them in place of the default ...Anna I think.

Thanks in advance
Private Sub Welcome(LogName As String)
Dim speaks, speech
speaks = "Welcome," & LogName & ", let's get down to business"
Set speech = CreateObject("sapi.spvoice")
speech.Speak speaks
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
Commented:
I don't use SAPI, but this link seems to show how to change Voices:

http://msdn.microsoft.com/en-us/library/ms723614(v=VS.85).aspx

The code there is Visual Basic, but it will work in VBA as well. The code uses form-level declarations; you might need to move them to your Module instead, depending on your needs.
Try to add

Set speech.Voice = speech.getvoices.Item(0)
0 - first available voice.
You can also use extended version:

Set speech.voice = speech.GetVoices("Name=Microsoft sam", "Language=409").Item(0)
ynot8669Owner

Author

Commented:
Used the code as supplied on MSDN. Had to add Microsoft Speech library to references in access ... it worked fine.

It seems Win7only has the one voice Anna, so I will now try and seek out more that I can use without having to install the full SAPI SDK.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial