FIX: Excel Automation from VBScript Gives Type Library Error

ID: Q234675


The information in this article applies to:
  • Microsoft Visual Basic, Scripting Edition, versions 3.0, 4.0
  • Microsoft Internet Explorer (Programming) versions 4.0, 4.01
  • Microsoft Excel 97 for Windows


SYMPTOMS

When writing VBScript code that performs Automation to a US-English version of Microsoft Excel 97, if the regional settings of the client machine are not set to US English, the following error might occur:

Old format or invalid type library


CAUSE

The reason for the error is that the VBScript engine that ships with Internet Explorer 4.0 uses the regional settings of the client machine to pass a locale identifier (LCID) to the GetIDsOfNames method of Excel's IDispatch interface. Excel attempts to load a type library specific to the language identified, and this causes the above error if no such version of the type library exists on the client machine.


STATUS

The problem has been fixed in version 5.0 of the Microsoft VBScript engine (VBScript.dll) that ships with Internet Explorer 5.0. To download a copy of IE5, go to the following Web site:

http://www.microsoft.com/windows/ie

Users of IE3/4 can solve the problem by upgrading their scripting engines. To do so, go to the Microsoft Scripting Web site and choose to download the Microsoft Scripting Engines Version 5.0:

http://msdn.microsoft.com/scripting


MORE INFORMATION

Automation servers use LCIDs to localize property/method names so developers can write Automation code in a language other than US English. In earlier versions of Excel (such as Excel 95), if the LCID was not recognized or the appropriate library was not found, the default language would be used. Because it was determined that a client would be unable to tell whether a call failed because of the LCID or for some other reason, the behavior was changed for Excel 97 to explicitly return an error if the LCID is not valid. It is then up to the client to check for the error and request the default languange if the LCID was incorrect.

Version 5.0 of the VBScript engine was modified to capture this type of error and request the default language if an Automation server does not support the LCID made from the client's regional settings.

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Richard R. Taylor, Microsoft Corporation

Additional query words:

Keywords : kbAutomation kbExcel kbVBScript kbGrpDSO
Version : WINDOWS:3.0,4.0,4.01,97
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: June 24, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.