ExcelComAddInHelper Throw Exception

Jul 29, 2014 at 8:31 AM
Edited Jul 29, 2014 at 8:32 AM
hi,govert

In My Addin ,I used ExcelComAddInHelper

public void AutoOpen()
{
//...

 ExcelDna.Integration.CustomUI.ExcelComAddInHelper.LoadComAddIn(com_addin);
//...
}

And When I Open Excel file,it working properly.

But I used Process.cs to open file,Excel will collapse.

Process myProcess = new Process();
myProcess.StartInfo.FileName = "c:\aa.xlsx"
myProcess .Start();

Exception like:
ExcelComAddInHelper Load Error!
System.UnauthorizedAccessException: 对注册表项“HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\xxxx”的访问被拒绝。
在 Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
在 Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistrySecurity registrySecurity)
在 Microsoft.Win32.RegistryKey.CreateSubKey(String subkey)
在 Microsoft.Win32.Registry.SetValue(String keyName, String valueName, Object value, RegistryValueKind valueKind)
在 ExcelDna.ComInterop.ComRegistration.ComAddInRegistration..ctor(String progId, String friendlyName, String description)
在 ExcelDna.Integration.CustomUI.ExcelComAddInHelper.LoadComAddIn(ExcelComAddIn addIn)
在 Gildata.EXCEL.AddIn.ThisAddIn.AutoOpen()
Coordinator
Jul 30, 2014 at 9:04 PM
Hi,

I suggest you upgrade to the latest Excel-DNA release (version 0.32).
It should work fine there - I made some improvements to the Application COM object management at startup.

(You'll also see the ExcelComAddInHelper and ExcelComAddIn moved to the ExcelDna.Integration namespace.)

If it's still a problem with the current Excel-DNA version, write back and I can make a walkthrough for you to try.

-Govert