tags:

views:

93

answers:

1

I have two MS Office add-ins written in VBA that I would like to package into an installer, along with some support files. Since VB passwords protecting add-in code can be hacked pretty easily, I want to "convert" the VBA code in my add-ins to DLLs, then call the DLLs from the add-ins.

What are my options for "putting" VBA code in DLLs? Can Visual Studio handle this? Any good links that provide some very basic instruction on this stuff? Thanks.

+2  A: 

Since no-one else has answered... I have no personal experience doing this although I have used VBA, VB6, and have written VB6 DLLs that are add-ins for other 3rd party software (although not Office).

The easiest way would be to convert your VBA code to a VB6 COM add-in. Then you shouldn't have to change the guts of your code, since VBA is 99% identical to VB6, and you can code against the same Office object model. You would need to change the housekeeping that links your add-in into Office. Here's a 2002 Microsoft MSDN article on how to write Office add-ins in VB6.

Alternatively you could migrate your VBA to VB.Net as a VSTO add-in. VB.Net is fully supported, whereas only the VB6 runtime is now supported. The disadvantages are it could be a lot of work, with new stuff to learn and buy. You would need to use an obfuscator otherwise your .Net code could be decompiled even more easily than password protected VBA.

Before you decide, ponder how many pirates will be attacking your code, how bad it would be if they crack it, and what's to stop them just copying your binaries anyway (without decompiling)? The right answer might be just to stick with VBA add-ins.

MarkJ
Thanks. I have decided to migrate from VBA to VB.NET, as the language is not that much different. Your tip on obfuscation is helpful.
Ryan