I have a simple class library that I use in Excel. Here is a simplification of my class ...
using System; using System.Runtime.InteropServices; namespace SimpleLibrary { [ComVisible(true)] public interface ISixGenerator { int Six(); } public class SixGenerator : ISixGenerator { public int Six() { return 6; } } }
In Excel 2007, I would create a macro-enabled workbook and add a module with the following code:
Public Function GetSix() Dim lib As SimpleLibrary.SixGenerator lib = New SimpleLibrary.SixGenerator Six = lib.Six End Function
Then in Excel, I could call the GetSix () function, and it will return six. This no longer works in Excel 2010 64bit. I get a "429" runtime error: ActiveX component cannot create an object.
I tried changing the target platform to x64 instead of Any CPU, but then my code will not compile unless I uncheck the Register for COM interop option, so that it does not display SimpleLibrary.dll in my macbook because it is larger not registered.
Any ideas on how I can use my library with 64-bit version of Excel 2010?
source share