Run-time error '13' or Run-time error '-2147221163' When Passing Collection Object to Visual Basic 6.0 ActiveX EXE

Article ID: 948463 - View products that this article applies to.
Expand all | Collapse all
Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action



You attempt to pass a Visual Basic 6.0 Collection object to an out of process component (ActiveX EXE).











Result





You receive one of the following errors:



Run-time error '13': Type mismatch

-or-

Run-time error '-2147221163 (80040155)': Method '~' of object '~' failed

Cause



Microsoft Office 2007 was previously installed on the computer, and has since been uninstalled. Uninstalling Microsoft Office 2007 removes the following registry keys which define the Visual Basic Collection interface.

[HKEY_CLASSES_ROOT\Interface\{A4C46780-499F-101B-BB78-00AA00383CBB}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{A4C46780-499F-101B-BB78-00AA00383CBB}]











Resolution



Manually register the Visual Basic 6.0 run-time DLL (msvbvm60.dll) by following these steps.

1. Click the Windows Start button, and then click Run.

2. In the Open box, type the following, and then click OK.

regsvr32 c:\windows\system32\msvbvm60.dll

You should receive the message "DLLRegisterServer in msvbvm60.dll succeeded."

More Information



Steps to reproduce the behavior
1. Create a new ActiveX EXE project in Visual Basic 6.0 named AXServer.
2. Create a new class named clsTest, with the following code:

Public Sub MyMethod(ByRef col As Collection)
Dim c As Collection
Set c = col
MsgBox "Inside ActiveX EXE"
End Sub

3. Save the project and compile AXServer.exe.
4. Create a new Standard EXE project in Visual Basic 6.0.
5. Set a reference to AXServer.exe.
6. Add a button to the default form, and add this code to its Click event handler:

Private Sub Command1_Click()
Dim c As Collection
Dim server As AXServer.ClsTest
Set c = New Collection
Set server = New AXServer.ClsTest
server.Test c
End Sub

7. Compile the project to create Project1.exe.
8. Run Project1.exe.
9. Click the button. Note that it runs with no error.
10. Exit Project1.exe.
11. Install Microsoft Office 2007.
12. Uninstall Microsoft Office 2007.
13. Run Project1.exe and click the button. Note that you receive the error:

Run-time error '-2147221163 (80040155)': Method '~' of object '~' failed

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

Properties

Article ID: 948463 - Last Review: January 29, 2008 - Revision: 1.2
APPLIES TO
  • Microsoft Visual Basic 6.0 Enterprise Edition
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
Keywords: 
kbnomt kbrapidpub KB948463

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com