AccessViolationException when trying to get ScreenUpdating property RRS feed

  • Question

  • We are developing an Excel addin and last week one of our customers experienced an issue with our addin. He tried to use a function that copies a worksheet from a template file to the current workbook. Before we start copying we disable the calculations and screen updating. But getting the current value of the ScreenUpdating property causes an AccessViolationException. Here is a screenshot that the users sent us:

    The code in DisableScreenUpdating is:

    try {
       screenUpdating = Application.ScreenUpdating;
       Application.ScreenUpdating = false;
    catch (Exception exception) {

    We save the current value of the property and then disable it. But when accessing the current value the exception happens.

    What could be causing this? We are using exact same logic on other locations as well. Here it is the first step, then we copy a worksheet to the current workbook and then restore the saved state.

    Friday, July 24, 2015 9:15 AM

All replies

  • Hello Mitja,

    Based on the screenshot you use Add-in Express, not VSTO. So, I'd suggest contacting them first.

    Friday, July 24, 2015 9:21 AM
  • But the call that caused the actual exception is Microsoft.Office.Interop.Excel._Application.get_ScreenUpdating().

    Is not that part of VSTO?

    Friday, July 24, 2015 9:26 AM
  • Nope. 

    Try to reproduce the issue with a standalone application and post your issue (if any) to the Excel for Developers forum instead.

    Friday, July 24, 2015 10:38 AM
  • Hi,

    Are you developing an Excel add-in ? I have made a test to run the code you provided, it works fine without error.To narrow down the issue, could you please share more information about this ? when you run this code (I run this code in a button click event, and it works fine) ? What's your Excel version? could you please share a sample that could reproduce this issue ?

    Best Regards, 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 30, 2015 5:47 AM
  • Hi Mitja

    To expand on Eugene's reply, VSTO is a set of tools that extends the Office object model (the "Interop". Since you're not working with this specific set of tools, but with a third-party application, and the problem is with the Excel "Interop", you'll have better chances of getting help in the Excel-specific forum. So I'm going to move this discussion there for you :-)

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, July 30, 2015 4:44 PM
  • According to your screenshot, I find that exception is "Zebra BI" has failed an exception. Is the "ZabraBI.dll" a reference or the add-in assembly? That is helpful for us to narrow down this issue.
    Tuesday, August 4, 2015 9:12 AM
  • ZebraBI.dll is our addin assembly.
    Monday, August 10, 2015 9:20 AM
  • >>>We are using exact same logic on other locations as well.

    I suspect there are some corruption with customer's environment. So I suggest that you could find out which difference is on customer's enviroment like Office, .Net framework or VSTO runtime , or make sure to clean up the workbook and observe how the workbook is behaving with logic codes.

    • Proposed as answer by David_JunFeng Tuesday, August 18, 2015 1:21 AM
    Tuesday, August 11, 2015 8:56 AM