Steve
Sat Jan 12 07:36:17 PST 2008
Mike,
You're welcome. I've only used the object sparingly and only to speak short
lines but you can do other things like play a .wav file. For reference,
this article might be of use:
http://www.microsoft.com/technet/scriptcenter/funzone/games/sapi.mspx
Steve Yandl
"MikeB77" <MikeB77@discussions.microsoft.com> wrote in message
news:A9C1C637-4D08-4603-933D-8AF31B6B52AD@microsoft.com...
> Thanks Steve. That may be a different object, or just a easier way to
> SAPI:
> either way its got it nailed. No setting references required!
>
> Mike
>
> "Steve Yandl" wrote:
>
>> Mike,
>>
>> This may be a different object but what I use from vbScript also works in
>> VBA routines. See if you can make this do what you want.
>>
>> strText = "This is a test"
>> Set objVoice = CreateObject("SAPI.SpVoice")
>> objVoice.Speak strText
>>
>>
>> Steve
>>
>>
>>
>> "MikeB77" <MikeB77@discussions.microsoft.com> wrote in message
>> news:4149EB41-EF0E-471E-9888-A5910567B4D8@microsoft.com...
>> > Thanks for your assistance. I should have thought of that.
>> > But when I try:
>> > set voc = CreateObject("SpeechLib.SpVoice") or
>> > Set Voc = CreateObject("SpVoice")
>> > or similar I get error 429: ActiveX can't create object. I've read
>> > that
>> > ActiveX components can't create user defined funcitons
>> > (
http://support.microsoft.com/kb/184898). So am I going about this the
>> > wrong
>> > way?
>> >
>> > Thanks
>> > Mike
>> >
>> >
>> >
>> >>
>> >> Use late binding instead. In other words, use GetObject or
>> >> CreateObject
>> >> to
>> >> assign the object to a variable declared as an Object.
>> >>
>> >> Then if the CreateObject call fails (i.e. the object is Nothing after
>> >> the
>> >> call) you can act accordingly.
>> >>
>> >>
>> >> --
>> >> Regards
>> >> Jonathan West - Word MVP
>> >> www.intelligentdocuments.co.uk
>> >> Please reply to the newsgroup
>> >>
>> >>
>> >>
>>
>>
>>