关闭Office应用程序,无需用户交互 [英] Close Office applications without user interaction

查看:102
本文介绍了关闭Office应用程序,无需用户交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何(或有任何信息链接)自动关闭.net和C#中的Office应用程序(主要是Excel,Word,Powerpoint,IE,Outlook),而不会出现确认消息,例如'一个名为的文件'Book1.xlsx'在这个位置已经存在
。你想替换它吗?'。 理想情况下,这段代码应自动/默认选择Yes或导致此消息根本不显示,而不是在调用'Application.Quit();'语句后需要用户交互。 
希望这是有道理的。

Hi, Does anyone know how to (or have any information links) for automaticlly closing Office applications (mainly Excel, Word, Powerpoint, IE, Outlook) in .net and C#, without the confirmation messages appearing eg 'A file named 'Book1.xlsx' already exists in this location. Do you want to replace it?'.  So ideally this segment of code should automatically/default select Yes or cause this message not to appear at all, rather than needing user interaction after the 'Application.Quit();' statement is called.  Hope this makes sense.

推荐答案

你好SWClarke,

Hi SWClarke,

我认为没有如果文件已经存在,则禁用替换对话框的任何方法。

I don't think there is any way to disable the replace dialog box if a file already exists.

但是,由于您正在运行自定义代码并调用Save方法,为什么不添加条件来检查是否存在文件,并在调用Save()之前将其删除?

However, since you are running custom code and calling Save method, why not add a condition to check of the existence of the file, and delete it before calling Save()?

问候,

Manvir Singh

Manvir Singh


这篇关于关闭Office应用程序,无需用户交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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