Try using
try...catch
:
object readOnly = false;
object isVisible = true;
Word.Application app = new Word.Application();
try
{
app.WindowState = Word.WdWindowState.wdWindowStateMaximize;
app.Visible = true;
Word.Document doc = app.Documents.Open(ref filename, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
doc.Activate();
doc.Save();
doc.Close(ref missing, ref missing, ref missing);
}
catch(Exception ex)
{
}
finaly
{
app.Quit(ref missing, ref missing, ref missing);
}