ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automating Excel WorkBook With C# Suppress Excel Message Boxes Possible? (https://www.excelbanter.com/excel-programming/275530-automating-excel-workbook-c-suppress-excel-message-boxes-possible.html)

unemotionalhumanoid

Automating Excel WorkBook With C# Suppress Excel Message Boxes Possible?
 
I am writing an application that gets data from excel worksheets, it works
fine for most workbooks but when I open some by using the following code:

_xlApp = new Excel.ApplicationClass();

Excel.Workbook WorkBook1 = _xlApp.Workbooks.Open(FilePath,0,true, 5,"",
"", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, false, false,
false);

Excel produces a message box saying:

Microsoft Office Excel recalculates formulas when opening files last
saved by an earlier version of excel (Yes / NO / Cancel)

Is there any way to suppress these annoying message boxes?

Thank you




jaf

Automating Excel WorkBook With C# Suppress Excel Message Boxes Possible?
 
Hi,
Add _xlApp.Application.DisplayAlerts=Fales beford the workbook open
statement.
And _xlApp.Application.DisplayAlerts=True after to re-enable.

--

John

johnf202 at hotmail dot com


"unemotionalhumanoid" wrote in message
...
I am writing an application that gets data from excel worksheets, it works
fine for most workbooks but when I open some by using the following code:

_xlApp = new Excel.ApplicationClass();

Excel.Workbook WorkBook1 = _xlApp.Workbooks.Open(FilePath,0,true,

5,"",
"", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, false, false,
false);

Excel produces a message box saying:

Microsoft Office Excel recalculates formulas when opening files last
saved by an earlier version of excel (Yes / NO / Cancel)

Is there any way to suppress these annoying message boxes?

Thank you







All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com