开发者

Referencing VBA assembly in C#

开发者 https://www.devze.com 2023-01-14 17:11 出处:网络
How do I reference VBA assembly in C# application from Visual Studio 2010? I can not find it in \"Ad开发者_运维技巧d Reference\" dialog box.

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

I can not find it in "Ad开发者_运维技巧d 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'. ...


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号