Hey,
I am trying to create a add-in for Excel. After registration in Regedit, it is visible in the option window for Excel-add-in's.
But when I want te use a function within this add-in, it is nowhere to be found.
Also I noticed that the add-in is still inactive and nowhere to befound inside the Excel-addins from Regedit
Is there anyone who can help me?
Is is my code from the dll, Class Zoek:
[ComVisible(true)]
[Guid("17E5A96C-E727-40F9-A7C6-26CEC23F07F0")]
//[ComSourceInterfaces(typeof(IZoek))]
[ComDefaultInterface(typeof(IZoek))]
[ClassInterface(ClassInterfaceType.None)]
// [ProgId("AgbExcel.Zorgverlener.Zoek")]
public class Zoek : IZoek
{
private readonly AgbcodeServiceSoapClient _agbServiceClient;
public Zoek()
{
_agbServiceClient = new AgbcodeServiceSoapClient();
}
#region Excel Functions
#endregion
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type type)
{
Registry.ClassesRoot.CreateSubKey(
GetSubKeyName(type, "Programmable"));
RegistryKey key = Registry.ClassesRoot.OpenSubKey(GetSubKeyName(type, "InprocServer32"), true);
key.SetValue("", System.Environment.SystemDirectory + @"\mscoree.dll", RegistryValueKind.String);
}
[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type type)
{
Registry.ClassesRoot.DeleteSubKey(
GetSubKeyName(type, "Programmable"), false);
}
private static string GetSubKeyName(Type type,
string subKeyName)
{
System.Text.StringBuilder s = new System.Text.StringBuilder();
s.Append(@"CLSID\{");
s.Append(type.GUID.ToString().ToUpper());
s.Append(@"}\");
s.Append(subKeyName);
return s.ToString();
}
}
And My Interface IZoek:
[ComVisible(true)]
[Guid("8F879475-AA4A-473E-B094-5F2F47899D46")]
public interface IZoek
{
#methods
}