I have recently had the task to write a small library to service some serial communications in a VBA client (lets say excel for the sake of this post). To help give us greater flexability, I decided to write a
COM .DLL library in .net and then reference this in VBA where a wrapper class can expose all its goodness! However I soon ran into problems just setting up the class due to ‘Can’t create object’ errors when trying to create it in the VBA code. Here is the solution…
So after scratching my head on this issue for way longer than I’d like to admit, the fault lay in that my VBA deployment was running x64 and my Visual Stu
dio profile was set to
deploy as ‘Any CPU’ which is basically x86. The simple fix was to compile the .net library in x64 and all was fine!