We recently upgraded from Excel 2007 to Excel 2010, and we have found that existing code started failing.
Exception Message:
Office has detected a problem with this file. To help protect your
computer this file cannot be opened.
We have traced this to the line where we open the file
excelApp.Workbooks.Open
Even when opening the file manually, the Protected View Messagebox comes up.
How can we work arround this using C#.
Have a look at using Application.FileValidation Property (Excel) before your
Openstatement.You can set it to one of the enum values in MsoFileValidationMode Enumeration
if you set it to
msoFileValidationSkipbefore theOpenstatement, it should bypass the check.Something like
before the open statement.