title: How do I call an add-in function in one XLL from another XLL
body: <p>I have made an XLL+ user defined function, sum1, and it can run smoothly in Excel after I add this add-in. But now I am building another XLL， say sum2. I wish I can call sum1 in this add in sum2. As sum1 and sum2 are in different XLL, they can not be called directly and need some codes to do that. Does any one meet this problem before and any good way to do that?</p>
  
  <p>I googled the problem and found the codes below, which is done by evaluate and UDF function. But it seems the code is very old and is suitable for visual studio 2005 but not for 2012 and I can get the #Name error when I run it.</p>
  
  <p>Will be really appreciate if someone can help me on this. Thank you very much.</p>
  
  <pre><code>// Function:    CalDaysInYear2
  // Purpose:     Calls a function in another XLL
  
  //{{XLP_SRC(CalDaysInYear2)
      // NOTE - the FunctionWizard will add and remove mapping code here.
      //    DO NOT EDIT what you see in these blocks of generated code!
  IMPLEMENT_XLLFN2(CalDaysInYear2, "RI", "CalDaysInYear2", 
      "DayCount", "Date &amp; Time", "Calls a function in another XLL,"
      " which returns number of days in a year according to the"
      " day count", "Day count convention\000", "\0appscope=1\0",
      1)
  
  extern "C" __declspec( dllexport )
  LPXLOPER CalDaysInYear2(short DayCount)
  {
      XLL_FIX_STATE;
      CXlOper xloResult;
  //}}XLP_SRC
  
      static int xlfEvaluate = 257;
      static int xlUDF = 255;
  
      CXlOper xloName, xloRef;
      int rc = 0;
      xloName = "CalDaysInYear";`enter code here`
      if (!rc)
          rc = xloRef.Excel(xlfEvaluate, 1, &amp;xloName);
      if (!rc)
          rc = xloResult.Excel(xlUDF, 2, &amp;xloRef, &amp;CXlOper(DayCount, 0));
  
      return xloResult.Ret();
  }
  </code></pre>