none
COM Excel Addin : RTD ConnectData being called before COM Addin initialization RRS feed

  • Question

  • I am facing an issue with Excel Addin. I have two <g class="gr_ gr_39 gr-alert gr_gramm gr_run_anim Style multiReplace" data-gr-id="39" id="39">versions  one</g> which uses IDTExtensibility2 and other is the VSTO based <g class="gr_ gr_29 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="29" id="29">addin</g>. We have a COM Library which we have registered as RTD Server with Excel through regsvr32. The registration takes place at time of installation of excel <g class="gr_ gr_46 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="46" id="46">addin</g>

    The following issue occurs with both the above versions.

    When I run excel through command prompt and open a sheet which contains UDF 

    start excel.exe "filename"

    In this case, RTD Server calls Server_Start and ConnectData before my <g class="gr_ gr_57 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="57" id="57">addin</g> is initialized [ Addin Startup /OnConnection].I have placed checks not to calculate UDF before my <g class="gr_ gr_65 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="65" id="65">addin</g> is initialized.

    Hence, I need to re-calculate all the formulae on my sheet after the initialization.But ExcelApplication.CalculateFull does not trigger RTD.ConnectData and all my formulae calculate to #NA

    Any suggestions on how I can re-calculate the UDF on the sheet.

    Thanks

    K Arora


    • Edited by K Arora Thursday, March 2, 2017 7:18 AM
    Thursday, March 2, 2017 7:14 AM

All replies

  • Hi,

    >> When I run excel through command prompt and open a sheet which contains UDF

    If you manually open the excel, will this issue exist?

    How did you use RTD.ConnectData in VSTO solution? It would be helpful if you could share us demo project and detail steps, and then we could try to reproduce your issue.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 3, 2017 4:53 AM
  • Hi Edward,

    Thanks for your reply.

    If I open the sheet manually, the issue does not occur.

    I have a class as a part of my COM project that implements IRTDServer interface .

    I have solved the above issue by placing safety checks in the ConnectData method and then after the excel addin is started , I call Excel method CalculateFull .

    This refreshes my formula and the UDF are re-calculated.

    Thanks

    Kanika 

    Tuesday, March 7, 2017 6:41 AM
  • Hi Kanika,

    Thanks for sharing, and I would suggest you mark your reply as answer, and then others who run into the same issue would find the solution easily.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 7, 2017 7:58 AM