Forum Discussion
mike_s
Dec 12, 2018Copper Contributor
Add-in registry access problem
I am the author of an add-in (Rainbow Analyst) which retrieves certain stored user details from the Windows Registry during startup. This code has operated without any problem for some years now, but...
- Dec 12, 2018Does it help to postpone the registry reads until Excxel has really fininshed starting up? What I usually do to allow Excel to finish it's business during startup is (in Workbook_Open) schedule a macro called "ContinueOpen" situated in a normal module using Application.Ontime. This prevents all sorts of issues stemming from Excel not having finished to load completely when your Workbook_Open is called.
JKPieterse
Dec 12, 2018Silver Contributor
Does it help to postpone the registry reads until Excxel has really fininshed starting up? What I usually do to allow Excel to finish it's business during startup is (in Workbook_Open) schedule a macro called "ContinueOpen" situated in a normal module using Application.Ontime. This prevents all sorts of issues stemming from Excel not having finished to load completely when your Workbook_Open is called.
mike_s
Dec 12, 2018Copper Contributor
Many thanks Jan Karel for this prompt and helpful response; much appreciated, and I'll certainly give this a go. There's a slight potential issue because the add-in uses the registry reads to determine what tab or icon to display on the Ribbon (using the isVisible property of the IRibbonControl objects), but I guess it shouldn't be a problem to delay the Ribbon display by a fraction of a second. I'll try it and post again to confirm the outcome.
- mike_sDec 12, 2018Copper ContributorExcellent; this has solved the problem! I've set all custom tabs as initially invisible, then run the rest of the start-up code after one second and refreshed the ribbon (with .Invalidate), and all works fine. Many thanks again for your help.
- JKPieterseDec 12, 2018Silver ContributorYou're welcome. I have fixed issues like these using this technique in quite some of my add-ins as available through https://jkp-ads.com/download.asp