Registering .Net DLLS’ for use in VB6 32bit Applications

Registering .Net Dlls’ for use in VB6 32  or VBA applications

You have that legacy application that is not willing to go away and you need to use functionality from code you created in .Net. or you need to build extra functionality on a .Net classYou need to register the dll for VB6/VBA  to be able to find it.

Best thing to do is to create a batch file with the following code:

1) Make the call from you application folder, so you need to move your cursor to that folder
2) Unregister the dll – this is really important as windows registry can get really messy and totally confused if you have multiple versions of the same dll
3) Register the new dll. NOTE: Use the /codebase switch otherwise it just won’t happen

Here is the batch file code:

cd C:\Program Files\YourApplication\
C:\windows\microsoft.net\framework\v2.0.50727\Regasm.exe /u YourNewcode.dll
C:\windows\microsoft.net\framework\v2.0.50727\Regasm.exe YourNewCode.dll /codebase

If your application is used by multiple users, you can add code to run the batch file when users load your application.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s