Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a DLL for VBA Class Module or better alternative?

Here's my issue: I wrote a VBA class module that consists of commonly used methods and functions. I am continually refining the module and making changes to it.

The problem is that I include this module in almost all of my VBA projects and I really don't want to keep importing the new module into each project everytime a change is made.

My question(s): Would it make sense to create a DLL that all of my projects would link to? Or is there an alternative solution that would make more sense?

Thanks

like image 380
UberNubIsTrue Avatar asked Oct 22 '22 18:10

UberNubIsTrue


1 Answers

If you're going to create a DLL, which I think makes perfect sense, you might want to do so in a language built on the .NET framework, such as VB.NET or C#. This provides the ability to combat the 32bit and 64bit issue by building both 32bit and 64bit versions.

It's worth noting that a 32bit DLL running on Windows 64bit with Office 32bit will function just fine. It's when the user is running Office 64bit that you need to worry.

With regards to deployment, you could spend a little extra time to create an installer (using NSIS for example) to make deployment much simpler. This installer would serve the purpose of registering the DLL on the target machine. You could also make the installer install both 32bit and 64bit versions of the DLL to guarantee the DLL will be compatible, regardless of the users configuration. I like the idea of registering both bit versions to avoid the scenario where a user has a Windows 64bit/Office 32bit environment and decides to upgrade their Office version to 64bit. If you have the 64bit version already installed, the reference to the DLL will resolve correctly.

like image 180
StoriKnow Avatar answered Oct 27 '22 07:10

StoriKnow