Microsoft® Windows® Script Host
<reference> Element
WSH Reference
Version 2


Description
XML element that includes a reference to an external type library.
Syntax
<reference [object="progID"|guid="typelibGUID"] [version="version"] />

Parameters
Part Description
progID The program ID from which the type library can be derived. It can include either a version number (for example, ADO.Recordset.2.0), the explicit program ID of a type library, or the program ID of the executable (such as a .DLL) that incorporates the type library. If you use the object attribute, you do need not specify a version attribute, because the version can be inferred from the program ID. If the object attribute is specified, you cannot also specify a guid attribute.
typelibGUID The GUID of the type library to reference. If the guid attribute is specified, you cannot also specify an object attribute.
version (Optional) The version number of the type library to use. It must be in the form <major version>[.<minor version>]. If a version is not specified, the default version is 1.0. If the object attribute is used to specify the type library and the version is not specified, the version is derived from the Registry key for the specified program ID. If none can be found, the default is 1.0.
Remarks
Referencing a type library in your Windows Script Component enables you to use constants defined in the type library in scripts. The <reference> element looks up and makes available the type library associated with a specific program ID or type library name. Type library information can be available in .tlb, .olb, or .dll files.

Error Values
The WSH run-time engine can return one of the following typelib-related error messages:

Error Description Reason
WSH 0201: Invalid type library specification The TYPELIB tag contains an invalid type library specification. Typelib is corrupt.
WSH 0202: Type library cannot be loaded Windows Script Host cannot load the type library specified in the TYPELIB tag. Cannot find/load the typelib.
WSH 0203:Type library cannot be wrapped Windows Script Host cannot create a Type Library Wrapper object from the type libraries specified in the TYPELIB tag. Other.