I am using Excel interop to perform manipulations on an existing Excel file. However, when I call Workbooks.Open(), it causes Excel window to open. Is it possible to prevent this, opening the workbook in memory only?

有帮助吗?

解决方案

Excel.Application app; // = your Excel application.
app.Visible = false;
app.DisplayAlerts = false;

The DisplayAlerts property is important to avoid having popups destined to the user. Especially if this code runs on a machine with no one to see the popup...

其他提示

Try setting ActiveWindow.Visible = False

Attention: If found a way to make the excel window visible when user has installed excel 2010. Does anyone know any ways to make the excel window visible with other excel version.

See my question and help to keep the excel windows hidden: C# Excel Interop prevent excel window from becoming visible

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top