.NET script working in Excel 2010 fails in Excel 2019 RRS feed

  • Question

  • I have a .NET script using the Excel API which assembled a new workbook from a set of template workbooks that each were dynamically recalculated at runtime and the resulting template ranges were subsequently copied into the new workbook. This script is run by my business and has worked for several years under Excel 2010 but sporadically failed for specific clients when I upgraded all users to Excel 2019 while not for others.

    Everything works well in Excel 2010, but in Excel 2019, failure was either by the final workbook.SaveAs() method on the resulting workbook failing or failure to acquire methods for a set of prior safety calls to workbook.activate() or workbook.select() methods to ensure the correct workbook was active before saving. Notably:

    1) By trapping the exception and making the used instance of Excel visible, I saw that the final workbook appeared correctly formed, but that I could not click on the final workbook's cells at all and for some reason, clicks were being interpreted as clicks on one of the templates that was copied into the final workbook instead. Attempting to save would save the template workbook instead, and only if I pressed escape on the template workbook's window several times and navigated the cursor around could I retain focus back onto the resulting workbook again and successfully save my result workbook.

    2) By making the instance of Excel visible from the very beginning of the process, the whole script successfully runs. However, I'd rather not interrupt the parent applications with an obtrusive set of visible Excel calls, and I'd rather keep what's going on non visible to clients.

    I've tried turning hardware acceleration off as well as UI animations but the same issue occurs. Does anyone have any experience with resolving any similar issues when moving from 2010 to 2019?

    • Edited by Randall T Saturday, April 13, 2019 3:19 AM
    Saturday, April 13, 2019 2:59 AM