Add-in doesn't run in second document RRS feed

  • Question

  • I have an Excel Com Add-in.  It is compiled on a computer with Win7 and Office 2010.  I loaded it on a computer with Win7 and Office 2013.  When I start Excel, all my menues load, everything runs fine.  When I start a second document (or open another document) the second (and all others folling) won't run the add-in code.  My custom menus are all there but nothing runs.

    Even if I close the first workbook, no book that was started after launching Excel will run the code.

    Help please.


    John G.

    Monday, February 24, 2014 10:44 PM

All replies

  • Hello John,

    Did you try to debug the add-in? 

    It looks like the issue depends on your code. The fact is that Excel doesn't run a new instance/process for another workbook. As a rule, all workbooks are run in the same process. Most probably you are refereeing to the first item from the Workbooks collection only. Is this the case?

    Did you try to open workbooks in separate processes? The Opening workbooks by running separate instances of Excel articles describes the required steps.

    Tuesday, February 25, 2014 6:11 AM
  • Thanks Eugene

    After reading the article you linked to, I see that the SDI (Single Document Interface) is what is causing the challenge.  I'll have to set up addtional error traps to try to catch new issues that the new environment will present.  Unfortunety, they say to adjust code for it but offer no guidance.

    One challeange is that my developement computer is Office 2010 and I'm testing Office 2013 on a virtual machine 1200 miles away over our network.

    If anyone has some usefull links on code differences required by the SDI, I'd appreciate them.


    John G.

    Tuesday, February 25, 2014 6:53 PM
  • H John,

    You just need to use properties that start from the Active word. For example, ActiveWorkbook, ActiveSheet and etc. for accessing the current object and use collections for checking what objects are loaded in Excel.

    Tuesday, February 25, 2014 7:15 PM