|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with using created COM object with C#.NET 2005 under Excel2003 (Framework 2.0)[assembly: ComVisible(true)] [assembly: ClassInterfaceAttribute(ClassInterfaceType.None)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cd099def-f9fb-407f-b793-9db68f6b8a0b")] This is my code: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Globalization; namespace ExtraStuff { [Guid("4E3BBC1B-625F-47bf-BE80-DAB84F1934BE"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch), ComVisible(true)] public interface IExtraStuff { [DispId(1)] double F2C(double val); } [Guid("F88DAD68-578A-4e23-BCFF-0FBBEC1C4B55"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IExtraStuff)), ComVisible(true)] public class ExtraStuffClass : IExtraStuff { public ExtraStuffClass() { } public double F2C(double val) { return ((5.0/9.0) * (val - 32.0)); } } } and excel vb code: Option Explicit Public Function F2C(val As Double) As Double Dim ccw As ExtraStuff.IExtraStuff Set ccw = New ExtraStuffClass F2C = ccw.F2C(val) End Function I put my dll to C:\Program Files\Microsoft Office\OFFICE11\ and I registered that by: regasm /tlb /codebase ExtraStuff.dll And when I'm trying use it I get error: 'Run-time error '-2147024894 (80070002)' In oleview.exe raport everything seems to be OK. Can anyone solve my problem ? |
|||||||||||||||||||||||