Search code examples
c#vbaassembly-references

Referencing VBA assembly in C#


How do I reference VBA assembly in C# application from Visual Studio 2010?

I can not find it in "Add Reference" dialog box.

This is the reason why I need it:

Error 1 The type 'VBA.Collection' is defined in an assembly that is not referenced. You must add a reference to assembly 'VBA, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'. ...


Solution

  • There are lots of versions of VBA, integrated in various application. Going by the version number, I'm guessing you need to use Project + Add Reference, Browse tab, select c:\windows\system32\msvbvm60.dll. That's the runtime support module for VB6. It indeed has a Collection class in the VBA namespace.

    Do try to double-check if the component was written in VB6. Deployment could be interesting.