如何覆盖其他Excel文件,而不需要对话框“真的要覆盖”在VB.NET中 [英] How can I overwrite an other Excel-file without the Dialog "Really want to overwrite" in VB.NET

查看:132
本文介绍了如何覆盖其他Excel文件,而不需要对话框“真的要覆盖”在VB.NET中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将我将使用VB.NE编辑的Excel文件保存到已存在的文件中?加班有一个对话框:文件已经存在。你真的想覆盖吗? YES | NO |中止

How can I save an Excel-file, which I'd edit with VB.NE, to a file, which already exists? Evertime there is a dialog: File already exists. Do you really want to overwrite? YES|NO|Abort

如果没有此对话框,我如何覆盖?

How can I overwrite without this dialog?

推荐答案

您应该看看设置

DisplayAlerts=false

Application.DisplayAlerts属性


将此属性设置为False,如果
不想在程序
运行时被提示
和警报消息打扰;任何时候一个消息需要一个
的响应,Microsoft Excel选择
默认响应。

Set this property to False if you don’t want to be disturbed by prompts and alert messages while a program is running; any time a message requires a response, Microsoft Excel chooses the default response.

只要记住重置

我们目前的做法如下

object m_objOpt = Missing.Value;
m_Workbook.Application.DisplayAlerts = false;
m_Workbook.SaveAs(  fileName, m_objOpt, m_objOpt, 
                    m_objOpt, m_objOpt, m_objOpt, 
                    XlSaveAsAccessMode.xlNoChange, 
                    XlSaveConflictResolution.xlLocalSessionChanges, 
                    m_objOpt, m_objOpt, m_objOpt, m_objOpt);

这篇关于如何覆盖其他Excel文件,而不需要对话框“真的要覆盖”在VB.NET中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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