How Can I Create a VBA Accessible DLL Users Do not Have to Register? RRS feed

  • Question

  • The question is at the bottom. There is some background information that may be helpful, which I will explain first.

    I work for a customer who has some VBA classes the access IBM Rational DOORS data. We'll call this collection of classes DoorsInterface. There are numerous dependencies on DoorsInterface: two projects in System Architect (SA) and a project in MS Word. The problem is that, rather than these classes being encapsulated in a single Project that is shared between the other three projects, the classes are copied between the three. So, if I make a change to one of the DoorsInterface classes, I have to copy the code from the one instance where I changed it into the other two copies. If we ever need to write additional VBA projects, this could get even more convoluted. So, my thought was, let's make these classes accessible to all three projects.

    I tried putting the classes in a Word Template and then including the template from the other Word Project and from the two SA Projects. This works fine for the Word Project, but SA is unable to access the template file's definitions.

    I also tried creating an SA Project that could be referenced from the other two SA projects and from Word. However, Word does not recognize the SA Project. Also, the DoorsInterface SA Project would need to be open for edit by the users in order for the other two projects to access it (an insane design).

    At the end of my rope, I requested IT to install Visual Studio, which they did, and I went about converting the VBA to VB. No I have a COM accessible DLL that I am able to access if I register it with Windows (using regasm). This takes administrative access (which I've been temporarily granted). I am able now to access the DLL from all Projects. However, the DLL would have to be registered for each user by IT in order them to use it. There are a lot of them.

    The idea of asking IT to register the DLL with all users and asking them to always remember to register it for future installs of DOORS and SA leaves a bad taste in my mouth.

    Is there any way to create a DLL that can be accessed from any VBA project without having to register the DLL for every user of the project? Thank you so much in advance for any help.

    • Edited by WoodRP Friday, March 29, 2019 9:06 PM
    Friday, March 29, 2019 9:05 PM

All replies

  • Have you looked into using registration-free com?

    There is a dated, but informative walk-through at Registration-Free Activation of COM Components: A Walkthrough

    And a current link for .net is at - Registration-Free COM Interop

    Regasm does not support per-user registration but a possible hack is to create a reg file that registers in HKCU instead of HKLM.  Such a reg file would allow users to register a COM dll on a system without requiring elevated privilege.
    • Edited by RLWA32 Saturday, March 30, 2019 12:40 PM added hack
    Friday, March 29, 2019 10:39 PM
  • Thank you for your response. I've given the articles a skim, and they seem like they have the potential to be a solution for me. I will read through this stuff more thoroughly on Monday and see if I can put some of this to use at work.

    If I am successful, I will post about it here. Thanks.

    Saturday, March 30, 2019 3:11 PM
  • I played around with this a little.

    I could get Excel VBA to instantiate a simple COM object, call a method and get/put property values when the registration-free COM Server was written in native C++.

    However, when I tried to do the same thing with a managed COM Server written in VB.Net, the CLR runtime could not find the DLL.  I suspect this is a constraint of using managed code for registration-free COM.

    Sunday, March 31, 2019 11:51 PM
  • I'm struggling with this. I'm beginning to wonder if just having the process discipline to copy the changes into the other projects using the code isn't my best option. I am so baffled by how hard this is.
    Monday, April 1, 2019 8:12 PM
  • You might consider the per-user registration option using .reg files.
    Monday, April 1, 2019 9:16 PM