In most cases, a VBA class module is identical to a VB class module; code from VBA class modules can be imported into VB, and vice versa. The sole exception is custom-defined events, which missed the release of VBA5 in Microsoft Office 97. What you can do with a class module, though, is different in VBA and VB. You can't compile a VBA class module into a standalone DLL or EXE; for this you need the retail version of VB.
of the same code. However, if you'd used a class to create your library, you could simply add a reference to your class to any new project. This gives you the advantage of not allowing the source code to be seen (or changed) in the current project, and of only having to make a change to a procedure in one place. Class modules therefore allow you to reuse code in a structured manner in your own projects, and others can use them in their classes without having access to your source code.
Was this article helpful?