问题
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:
I have interface
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface MyInterface { ... }
and class
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
[ProgId("MyClass.Id")]
public class MyClass { ... }
Excel creates the instance by
Dim c as MyClass
Set c = New MyClass
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?
- I checked everything some times. Error occurs exactly after deleting some methods
- This class is partial (maybe the problem is somewhere here?)
- Earlier everything worked..
回答1:
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.
来源:https://stackoverflow.com/questions/8817215/vba-and-class-doesnt-support-automation-or-does-not-support-expected-interface