Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need VBA to convert Text to Speech for audible messages 7

Status
Not open for further replies.

Dor100

Technical User
Apr 9, 2001
279
US
I've been searching Google to no avail so far. Are there any VBA commands in Acc XP by which I can cause text to be converted to speech in order to give audible messages to users? Or do people know of any free downloadable utilities for this?
 
This works for me:
Code:
Function TestMe()

    Dim objVo As Object
    
    Set objVo = CreateObject("SAPI.SpVoice")
    objVo.Speak "Thank you Fancy Prairie"

End Function
 
Way cool!

Thanks, FancyPrairie.




John

Use what you have,
Learn what you can,
Create what you need.
 
MichaelRed, not sure why you got that message. But am curious, does the Speech program via control panel work?
 
I've already posted at least 2 times on this topic, each time with the following warning:
Need Windows XP or above.
 
I just tried it using Acc XP with Win 2k and am getting an "object required" message on the "Set objVo = CreateObject("SAPI.SpVoice")" line. But this is exactly the kind of flexible option I'm looking for. Could it simply be that a new code reference is needed, or is PHV's last word the final curtain here for personal coding in your project? It's so close, and yet so far away...Is there perhaps a work-around or extra piece of code one can add to bridge the gap and get the app talking?
 
hmmmmmmmmmmmmmmmm ... mmmm

No. A variety of errors. Voice not available (for both choices), ? not installed ...



MichaelRed


 
MichaelRed - are you suggesting something can be done for the Win 2k/Acc XP set up to enable this text to speech coding in VBA? Exactly what would need to be installed if indeed that is what you are suggesting here?
 
The files you need should be at C:\Program Files\Common Files\Microsoft Shared\Speech. Specifically sapi.dll
 
Just checked and it's there - along with sapisvr.exe and sapi.cpl, and a folder called 1033 which contains spcplui.dll. Why do you think the error message I got would be an "object required" alert? Could it be a code ref? DLL registration?
 
BTW, Here are my current Acc XP code refs, in the exact order in which they appear:

Visual Basic For Applications
Microsoft Access 10.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.5 Library
Microsoft Excel 10.0 Object Library
Microsoft Word 10.0 Object Library
 
There's simply got to be a way to tweak Win 2k or XP to get the code to work...?
 
I don't know what else to tell you. Your references are ok and you have the correct dlls, etc in the correct place. Have you tried accessing speech via the control panel to see if it works there?
 
Yes, it's working there. I just ran regsvr32.exe "C:\Program Files\Common Files\Microsoft Shared\Speech\SAPI.DLL" as well (succeeded) and still get the "Object required" error for the TestMe fx. I find it hard to believe there's no solution to this for my operating system, even a fairly simple one.
 
I'm using yours:


Private Sub Command0_Click()
TestMe
End Sub
----------------------------------------
Function TestMe()

Dim objVo As Object

Set objVo = CreateObject("SAPI.SpVoice")
objVo.Speak "Thank you Fancy Prairie"

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top