Microsoft Knowledge Base Email Alertz

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

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]






Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

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

Article ID:948463
Last Review:January 29, 2008
Revision:1.2
Source: Microsoft Support

Back to the top

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.

Back to the top

Action



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











Back to the top

Result





You receive one of the following errors:



Run-time error '13': Type mismatch

-or-

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

Back to the top

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}]











Back to the top

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."

Back to the top

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

Back to the top

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.

Back to the top


APPLIES TO
•Microsoft Visual Basic 6.0 Enterprise Edition
•Microsoft Visual Basic 6.0 Learning Edition
•Microsoft Visual Basic 6.0 Professional Edition

Back to the top

Keywords: 
kbnomt kbrapidpub KB948463

Back to the top

   

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please