On Tue, 23 Jan 2007 11:20:03 +0100, "Torben Laursen"
<To****@newsgroups.nospamwrote:
>Thanks for the feedback
Morten could you give me some feedback on how to rewrite the Excel class to
I can hide these functions.
I understand that they are important to .Net, but my users have no need for
them inside Excel so they just "pollute" my interface
I don't inhert the class from anything so the compiler(or Excel 2003) adds
these functions to my class
Torben
snip<
Please don't toppost!
It can be done, you need to take control of how the COM interface is
constructed on your class. Have to post quickly now because I have to
go into a meeting but this is how it can be done. (Use Tools -Create
GUID to make your own guids).
First define an interface like this:
[ComVisible(true)]
[Guid("C63154DB-EB3E-4439-A9E4-015215BE116C")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
public interface MyInterface {
// your methods here
}
Then implement that interface on your class:
[Guid("DD364688-B80D-4bfc-A167-B01F2F03F68D")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("MyServer.MyClass")]
[ComVisible(true)]
public class MyClass: MyInterface {
// implementations of your methods
}
Note the ClassInterfaceType.None attribute. If you do this, what you
end up with is nice intellisense inside Excel which just shows the
methods you defined in MyInterface.
I blagged this off a webpage somewhere but can't for the life of me
find it now. However, if you do a google search on
ClassInterface(ClassInterfaceType.None) etc you will find plenty of
examples and explanations of what this is actually doing.
--
Philip Daniels