Question about WSH 2.0 TypeLibrary support? 
Author Message
 Question about WSH 2.0 TypeLibrary support?

You can't get a "reference" via the Word.Application object (or any of the Office "Blah.Application" objects).  But this will work:

<reference object='word.document' />

Do the same for other Office applications.  The reason is the CLSID keys pointed to by the "Blah.Application" progids don't have a TypeLib key.   But the application "document" type progids do...  It doesn't really matter which of a given application's "document" progids you use, within a given application they all point to the same type library.

--
Michael Harris


  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



Sun, 02 Jun 2002 03:00:00 GMT  
 Question about WSH 2.0 TypeLibrary support?
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



Mon, 03 Jun 2002 03:00:00 GMT  
 Question about WSH 2.0 TypeLibrary support?
I use the CDO TL all the time...
<package>
<comment>
 </comment>
 <job id="FromExchange">
  <reference guid="{3FA7DEA7-6438-101B-ACC1-00AA00423326}"/>
  <script id="test" language="VBScript">

  WScript.Echo CdoPR_DEPARTMENT_NAME

  </script>
 </job>
</package>

Regards (and Merry Christmas)
Ian
WSH FAQ http://wsh.glazier.co.nz


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



Mon, 03 Jun 2002 03:00:00 GMT  
 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



Mon, 03 Jun 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Psroff 2.0 Patch 6 (Supports RISC Ultrix!)

2. "Broken" WSH 2.0

3. WSH 2.0 and the AddPrinterConnection ?

4. WSH 2.0?

5. Deploying WSH 2.0

6. SetDefaultPrinter Method and WSH 2.0

7. WSH 2.0 install

8. WSH 2.0 newsletter available

9. Is WSH 2.0 installed with IE5.01?

10. WSH 2.0 include

11. What happen with WSF and DEBUG (WSH 2.0 Final Version)

12. How to debug in WSH 2.0

 

 
Powered by phpBB® Forum Software