VBA和"Class不支持自动化或不支持预期的接口" [英] VBA and "Class doesn't support Automation or does not support expected interface"
问题描述
我有带有ComVisible类的.NET程序集.几天前(我可以通过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却很疯狂-它向我显示错误 Class不支持Automation或不支持预期的界面
.哪里有问题?
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库中删除方法/属性后,应在Excel的文件中重新添加对.tlb文件的引用.
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和"Class不支持自动化或不支持预期的接口"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!