问题描述
我有.NET程序集与标记有ComVisible特性的类。几天前(我能找到的那一刻正是通过GIT)发生了一件事情 - Excel不会再看到这个类。所以:
I have .NET assembly with ComVisible class. Some days ago (I can find that moment exactly, by git) something happened - Excel doesn't see anymore this class. So:
我有接口
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface MyInterface { ... }
和类
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
[ProgId("MyClass.Id")]
public class MyClass { ... }
Excel中
Excel creates the instance by
Dim c as MyClass
Set c = New MyClass
此前的一切工作就像一个魅力,但之后的删除一些方法(从接口和类)Excel是疯了 - 它为我的错误类不支持自动化或不支持预期的接口
。在哪里可以是一个问题?
Earlier everything worked like a charm, but after deleting some methods (from interface and class) Excel is crazy - it shows me an error Class doesn't support Automation or does not support expected interface
. Where can be a problem?
- 在我检查一切有时。错误完全删除某些方法后,会出现
- 在这个类是局部的(也许问题出在这里?)
- 此前一切正常。
推荐答案
该死的三倍。对于未来的家伙:从你的COM库删除方法/属性后,您需要重新添加引用.TLB在Excel的文件,文件
Damn three times. For the future guys: after removing methods/properties from your COM-library you should re-add reference to .tlb file in your Excel's file.
这篇关于VBA和"类不支持自动化或不支持预期的接口"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!