我没有你想要替换的弹出消息 [英] i don't the pop up message for do u want to replace
问题描述
我保存了数据库中的所有条目。
然后我将数据库导出到excel,因为我编写了代码。
当我点击按钮数据库记录导出到excel时。
A filename''csharp。 netinformation.xls
''已存在于此location.Do你要替换它。
是否取消。
i不想要这个弹出消息。
i希望消息为:
创建Excel报告。
好的。
当用户按下确定打开excel文件时。
我的代码如下;
i saved all the entries in database.
then i export the data base in to excel for that i written a code.
when i click the button data base records are exported into excel.
A filename''csharp.netinformation.xls
'' already exists in this location.Do you want to replace it.
Yes NO Cancel.
i don''t want this pop up message.
i want the message as;
Excel Report created.
Ok.
when user press ok open the excel file.
my code as follows;
xlWorkBook.SaveAs("csharp.net-informations.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
xlApp.Visible = true;
releaseObject(xlApp);
releaseObject(xlWorkBook);
releaseObject(xlWorkSheet);
我的代码中的
我该怎么办?获取弹出消息需要进行哪些更改。
用户打开excel文件时。
来自我的代码请更正。
from my code how can i do. what changes required to get a pop up message.
when open a excel file by the user.
from my code please correct it.
推荐答案
您应该快速检查文件是否存在,以及是否在尝试保存新文档之前将其删除。
我不完全确定这是否会删除另存为对话框,但是值得一试。
You should add a quick check whether the file exists, and if it does remove it before trying to save the new document.
I''m not entirely sure if this will remove the save as dialog, but it''s worth a try.
if( File.Exists("csharp.net-informations.xls") )
File.Delete("csharp.net-informations.xls");
xlWorkBook.SaveAs("csharp.net-informations.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
看一下之前的解决方案:保存没有提示的excel文件 [ ^ ]。
干杯!
Have a look at this previous solution: Saving an excel file without prompt[^].
Cheers!
这篇关于我没有你想要替换的弹出消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!