Encountering an error using Tlbimp.exe

Posted on 2009-04-29
Last Modified: 2013-11-26
I have a VB6 program and need to expose its object model for use within a Visual Basic 2008 application.

I am using the Type Library Importer (Tlbimp.exe) to convert the type definitions found within the COM type library into equivalent definitions in a common language runtime assembly.

The Tlbimp.exe should emit a DLL file called a Primary Interop Assembly (PIA), but instead, it generates an error.

You help on this would be greatly appreciated.


The batch file command line is as follows:

call "%WindowsSDKPath%bin\tlbimp" %AppPath% /out:"%PIADir%\%PIAFile%" /keyfile:%KeyPath% /primary /verbose


The Tlbimp outputs the following error within the command prompt window:

TlbImp : error TI0000 : System.ApplicationException - Referenced type library 'VBA' does not have a primary interop assembly registered.
Question by:Leapingdog
    LVL 9

    Assisted Solution

    As far as I can see maybe the problem is that you are trying to publish a PIA that is referencing a library that is not a PIA. The only solution apparently is to create a wrapper to the required library.

    Read here :

    Author Comment


    Thanks for the feedback.  The link you sent me is not too specific on this top, but using a wrapper may be the way to handle the error.  

    It is strange that I don't even reference VBA within the code, so I would not even know what to wrap.


    Accepted Solution

    The solution:

    The actual error was that I had public collection objects within my object model.  The collection objects must be private before TlbImp will work.

    You can make the collection objects private using the following:

    Function NewEnum() As IUnknown
        Set NewEnum = colPArrays.[_NewEnum]
    End Function
    'And setting the type to -4

    Open in new window


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now