> I'm trying to programatically test if the Microsoft Speech Object Library
> is
[quoted text clipped - 10 lines]
>
> Can anyone shine some light on this one?
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.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
MikeB77 - 11 Jan 2008 10:28 GMT
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.
Steve Yandl - 11 Jan 2008 15:44 GMT
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
> Thanks for your assistance. I should have thought of that.
> But when I try:
[quoted text clipped - 15 lines]
>> Then if the CreateObject call fails (i.e. the object is Nothing after the
>> call) you can act accordingly.
MikeB77 - 12 Jan 2008 09:02 GMT
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
> Mike,
>
[quoted text clipped - 26 lines]
> >> Then if the CreateObject call fails (i.e. the object is Nothing after the
> >> call) you can act accordingly.
Steve Yandl - 12 Jan 2008 15:36 GMT
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
> Thanks Steve. That may be a different object, or just a easier way to
> SAPI:
[quoted text clipped - 35 lines]
>> >> the
>> >> call) you can act accordingly.