防止Workbooks.Open()使Excel在Windows资源管理器中可见 [英] Prevent Workbooks.Open() from making excel visible in windows explorer

查看:208
本文介绍了防止Workbooks.Open()使Excel在Windows资源管理器中可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Excel互操作对现有Excel文件执行操作.但是,当我调用Workbooks.Open()时,它将导致Excel窗口打开.是否可以防止这种情况,仅在内存中打开工作簿?

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;

DisplayAlerts属性对于避免弹出窗口发给用户很重要.尤其是如果这段代码在没有人看到的弹出窗口上运行……

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...

这篇关于防止Workbooks.Open()使Excel在Windows资源管理器中可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆