To hide the visual base editor (which shows when an error occurs), before trying to open the file, change the value of Excel.VBE.MainWindow.Visible to false. Keep in mind that if the debugger does not appear, you will have to catch the exception in your code, so convert your code with try catch.
If macros are not needed and can be ignored, use msoAutomationSecurityForceDisable to completely disable them.
using InteropExcel = Microsoft.Office.Interop.Excel; var Excel = new InteropExcel.Application ();
Alexandre Borela
source share