Regarding Com Registration

Oct 11, 2010 at 9:45 AM


I am trying to implement RTD Server using Excel DNA. Although documentation states that we don't require any registration but I found in the source code that at run time the  Excel DNA makes the COM Visible  true and registers the contents .My only concern is that if i distribute my xll file to friends who don't have admin rights to register, does this project will still work???? 

internal class ComAddInRegistration : Registration    {        private string _progId;
        public ComAddInRegistration(string progId, string friendlyName, string description)        {            _progId = progId;            // Register the ProgId as a COM Add-In in Excel.            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\" + progId, "LoadBehavior", 0, RegistryValueKind.DWord);            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\" + progId, "FriendlyName", friendlyName, RegistryValueKind.String);            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\" + progId, "Description", description, RegistryValueKind.String);        }
        protected override void Deregister()        {            // Remove Add-In registration from Excel            Registry.CurrentUser.DeleteSubKey(@"Software\Microsoft\Office\Excel\Addins\" + _progId);        }    }



Looking forward for a reply soon



Oct 12, 2010 at 2:09 PM

Hi Dee,

Indeed, for the RTD and Ribbon support Excel-Dna writes some entries in the registry at runtime which it deletes again before closing. It only writes to the current user's part of the registry (you'll see the HKEY_CURRENT_USER root in the code fragments you post), which is permitted even in restricted settings. So you should have no problem running RTD servers under limited permissions, as long as you have set the required add-in permissions in Excel to allow the add-in to run.

Let me know if you discover any problems in this regard.


Oct 12, 2010 at 2:14 PM

Ah - here is a post from the Google group on how the Excel settings affect Excel-Dna and the RTD support.

Regarding the Trust Center in Excel 2007 (I think it is the same in Excel 2010 but have not tested). 
Two parts of the Trust Center that affects Excel-Dna add-ins. 

1. Loading of the .xll add-ins is controlled by the Macro Settings tag in the Trust Center. I normally set this to "Disable all macros with notification". This ensures I get prompted when an .xll is loaded, and I can pick Enable.... when the .xll loads. If you set this to "Disable all macros without notification" your .xll will not load, and no message will be displayed, even if you have set the Message Bar section to "Show the Message Bar in all applications when content has been blocked." If the .xll is bot allowed to load, there is no Excel-Dna code that ever runs, so I can't really handle any of these cases better. 

2. Loading of the RTD support (but strangely not the Ribbon) under Excel-Dna is additionally also affected by the Add-ins tab of the trust center. If you select "Disable all Application Add-ins" (or select "Require all Application Add-ins to be signed by Trusted Publisher") your Excel-Dna .xll will load, but you'll get get #N/A for any RTD calls. I think Excel-Dna could give better support here - at least to show an error message in the Log window. 

I find all of this rather frustrating and confusing. Any help in investigating and documenting all of this would me most appreciated.