Using C# I am developing an Excel add-in. This add-in opens a Windows Form and needs to set ScreenUpdating to false so I am using the following code.
using Excel = Microsoft.Office.Interop.Excel;
[...]
ExcelApp = Globals.ThisWorkbook.ThisApplication;
ExcelApp.ScreenUpdating = false;
So far this works fine. However Excel locks up when closing the form and I don’t know why. When removing the following lines then closing the form is successful.
ExcelApp = Globals.ThisWorkbook.ThisApplication;
ExcelApp.ScreenUpdating = false;
Setting
ExcelApp.ScreenUpdating = true;before closing the form solves the problem.