Click here to Skip to main content
15,306,445 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Am using the Interop Word Dll to Generate Word Documents . My problem is that after writing a set of data to the newly created word file i get a save as dialog . How can i suppress/hide this save as dialog . Am using 3.5 Framework & office 2007.

Thanks in advance .
tssutha03 8-Dec-11 10:19am
Please refer this

Vinodh.B 10-Dec-11 5:49am
the above link coding i tried and Its failing .
private void DocumentBeforeSave()
    this.BeforeSave += new Microsoft.Office.Tools.Word.SaveEventHandler(ThisDocument_BeforeSave);

void ThisDocument_BeforeSave(object sender, Microsoft.Office.Tools.Word.SaveEventArgs e)
    if (MessageBox.Show("Do you want to save the document?", "BeforeSave",
        MessageBoxButtons.YesNo) == DialogResult.No)
        e.Cancel = true;
If we suppose that your Word application instance is named currentApplication then you should do something like this :

Also you can consider turning off display alerts :
currentApplication.DisplayAlerts = WdAlertLevel.wdAlertsNone

Hope it helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900