Reputation: 35265
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'. ...
Upvotes: 3
Views: 4276
Reputation: 941317
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.
Upvotes: 4
Reputation: 93424
An "assembly" is a set of .NET functions packaged in a common DLL or EXE. VBA is not .NET, therefore it does not exist as an assembly. You can, however, access VBA components via the COM Interop layer.
What I think you're probalby looking for is this
http://support.microsoft.com/?kbid=323737
Upvotes: 1
Reputation: 4768
You really don't need VBA.Collection type in C#, you have much better collection constructs available. Generic.List, Generic.Dictionary etc, if you have a look at those you will most likely find what you need.
These are strongly typed, so you won't be Casting to other types. If you need the VBA "Variant" type, you could use HashTable.
Upvotes: 0