Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable compatibility check in excel while automating through c#

I am using Excel 2007 interop assembly to automate Excel through c#. Interop version is 12.0. When I try to save a file, it can be saved only in 2003 format, but thats fine with me, yet I am getting a popup saying compatibility issue. How can I disable this popup?

I have already tried workbook.CheckCompatibility = false and ExcelApp.DisplayAlerts = false so please tell if I am making other mistakes.

I have MS Office 2007 installed on my computer.

Thanks in advance.

like image 399
j4m4l Avatar asked Jan 16 '12 11:01

j4m4l


People also ask

Why is Excel opening in Compatibility Mode?

It's most likely caused by your default setting being an older version of Excel, which causes the software to only use Compatibility Mode. Open Excel and either make a new document or open an existing one. Click on the File menu. Select Options from the left-side panel.

How do I turn off Compatibility Mode in Excel 2007?

To disable the Compatibility Checker in Microsoft Excel (for example Microsoft Excel 2007/2010): (Excel 2007) On the Office button, click Prepare, then Run Compatibility Checker, and then clear the Check compatibility when you save this workbook option.


2 Answers

Try ThisWorkBook.DoNotPromptForConvert = true

More info at DoNotPromptForConvert

like image 79
InBetween Avatar answered Oct 25 '22 00:10

InBetween


Try instead workbook.CheckCompatibility = false;

like image 41
Keith Avatar answered Oct 25 '22 02:10

Keith