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?
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?
You should have a look at setting
DisplayAlerts=false
Application.DisplayAlerts Property
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.
Just remember to reset it to true once you are done.
We currently do it as follows
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);
Couldn't you try to delete the file first, before overwriting it?
There is a property within the SaveFileDialog
class, called OverwritePrompt
, set that to false.
Hope this helps, Best regards, Tom.