M
mduncan
I have created an Automation Addin with the following code.
[ClassInterface(ClassInterfaceType.AutoDual)]
public class TestFunctions
{
private ApplicationClass excelApplication;
public TestFunctions()
{
// this.excelApplication = SOMETHING
}
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type type)
{
Registry.ClassesRoot.CreateSubKey(GetSubKeyName(type));
}
[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type type)
{
Registry.ClassesRoot.DeleteSubKey(GetSubKeyName(type),false);
}
private static string GetSubKeyName(Type type)
{
string s = @"CLSID\{" + type.GUID.ToString().ToUpper() + @"}\Programmable";
return s;
}
Using the code above I want to grab the instance of Excel THAT THE ADD_IN is
RUNNING in. I tried this.excelAppication = new ApplicationClass(), but that
just creates a new excel instance.
Any suggestions would be very helpful.
Thank you,
mduncan
[ClassInterface(ClassInterfaceType.AutoDual)]
public class TestFunctions
{
private ApplicationClass excelApplication;
public TestFunctions()
{
// this.excelApplication = SOMETHING
}
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type type)
{
Registry.ClassesRoot.CreateSubKey(GetSubKeyName(type));
}
[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type type)
{
Registry.ClassesRoot.DeleteSubKey(GetSubKeyName(type),false);
}
private static string GetSubKeyName(Type type)
{
string s = @"CLSID\{" + type.GUID.ToString().ToUpper() + @"}\Programmable";
return s;
}
Using the code above I want to grab the instance of Excel THAT THE ADD_IN is
RUNNING in. I tried this.excelAppication = new ApplicationClass(), but that
just creates a new excel instance.
Any suggestions would be very helpful.
Thank you,
mduncan