C # Excel 2010 Workbook Opening Error

We recently upgraded from Excel 2007 to Excel 2010, and we found that existing code started to crash.

Exception Message:

Office has detected a problem with this file. To protect your computer, this file cannot be opened.

We traced this to the line where we open the file

excelApp.Workbooks.Open

Even when you open the file manually, the protected view of Messagebox opens.

How can we work with this with C #.

+5
source share
3 answers

Look at using the Application.FileValidation Property (Excel) before the statement Open.

Gets or sets how Excel will validate files before opening them. Read / write

, , . FileValidation, , .

MsoFileValidationMode Enumeration

msoFileValidationDefault

msoFileValidationSkip

msoFileValidationSkip Open, .

-

excelApp.FileValidation = MsoFileValidationMode.msoFileValidationSkip;

open.

+12

, : " ".

, , , "Office . , ". .

, Daniel Pineault DevHut.net 2010 :

DevHut: VBScript

hellandgone VBA #, Daniel (, VBA, VBA , ). VBA, :

fooobar.com/questions/1123776/...

, - "Share and Enjoy".

, , , , : "", .

0

. SSIS SQL Excel.Interop . Office 2010 x64 , :

Office . , .

. Excel: 14.04763.1000 , 14.0.7015.1000 . Office 2010 SP2. SP2 , .

0

All Articles