Microsoft KB Archive/234675

= FIX: Excel Automation from VBScript Gives Type Library Error =

Article ID: 234675

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Visual Basic, Scripting Edition 3.0
 * Microsoft Visual Basic, Scripting Edition 4.0
 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q234675



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://msdn2.microsoft.com/en-us/library/ms950396.aspx



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.

Keywords: kbautomation kbbug kbfix kbnoupdate KB234675

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.