Jul 17, 2012 at 12:31 PM



I have a simple question. I currently register my xll addin using Application.RegisterXLL from VBA. The problem is that unless the user closes the Excel session, the readonly lock on the xll and dll is not released. So I cannot update/make changes to the codebase until all users have exited the Excel application.


Is there a way to de-register the xll when the spreadsheet is closed by any chance?


thank you for your help


kind regards

Jul 17, 2012 at 8:05 PM


I can suggest two approaches:

  • Don't try to unload the .xll, but rewrite the .dna file (which is never locked) to point to an updated .dll file (possibly in a different directory) and reload using Application.RegisterXLL again. Inside a .dna file, you <ExternalLibrary... /> tag can redirect to another .dna file. So you could structure an add-in as a set of different subdirectories, each with a new version of your add-in, and in the top-level directory put a .dna file that redirects to the current version's .dna file:


    <DnaLibrary >
      <ExternalLibrary Path="SubDirVersion3\AddInVer3.dna" /> 


  • Explore the Application.AddIns collection. I think you can also load the .xll with 


addIn = Application.AddIns.Add("c:\...\Addin.xll");
addIn.Install = true;

// Then uninstall (which I think unloads it) with
addIn.Install = false;




Jul 18, 2012 at 8:58 AM

hi Govert,


thank you for your prompt reply. I prefer the first approach as it gives you a crude version control, and if anything goes wrong, you can quickly roll it back without faffing around re-compiling the code etc etc.


I also played around with 2nd option, which also does work. 


thank you kindly