
Question about WSH 2.0 TypeLibrary support?
Ian, thanks for your suggestion (and also Merry Christmas).
Michal, your tip was what I was looking for. I played this morning
a bit with the <reference> element. Finally I found out, that there
are two possiblities to create a reference:
* We can use the uiid attribute and set the class id code of the type lib
as:
<reference guid='{00020905-0000-0000-C000-000000000046}'/>
* Or we need to combine the object attribute with the version attribute as:
<reference object="word.document" version="8.0"/>
My first attempt to use the object attribute as:
<reference object="word.document"/>
failed. I got a run time error reporting that the type lib
{00020905-0000-0000-C000-000000000046} can't be added. Only after adding
explicitely the version value,
things works well. Below is the code sample I finally used:
<?xml version="1.0"?>
<job id="RefExample">
<?job debug="true"?>
<comment>
we may use the element
<reference guid='{00020905-0000-0000-C000-000000000046}'/>
to access the library. Or we can use the code given below,
in this case a version if mandatory.
</comment>
<reference object="word.document" version="8.0"/>
<script language="VBScript">
<![CDATA[
Set Tmp = WScript.CreateObject("Word.Application")
WScript.Echo "wdBlack = " & wdBlack
]]>
</script>
</job>
I wrote today the fourth newsletter which contains something like a FAQ
about WSH 2.0 topics. The newsletter may be downloaded from the WSH Bazaar
at:
http://ourworld.compuserve.com/homepages/Guenter_Born/index0.htm
Regards
G. Born
,
Gnter Born schrieb in Nachricht
Quote:
>Hi all,
>was somebody successful to use a type library reference from WSH 2.0.
>I tried to use the following code:
><?xml version="1.0"?>
><job id="Sample">
><reference object='Word.Application' version='9.0'/>
><script language='VBScript'>
> WScript.Echo "Hello " + wdWrapType
></script>
></job>
>to display the value of the Word constant. But all I got was a run-time
>error,
>reporting "cannot find the type library for this reference:
>Word.Application".
>I tried the code with and without the version attribute. And I'm sure the
>application is installed.
>Any suggestion is appreciated.
>Thanks
>G. Born