I am processing a word document using mergefield and bookmark.The application runs well while in debug mode but it throws error on release mode.I am new to word automation.Please help.If need any other details please let me know.Source code is given below.
> Blockquote
object nothing = System.Reflection.Missing.Value;
object filename = "E:\\Templatenew.doc";
object destination = "E:\\new.doc";
object nottrue = false;
object oPrintdate = "printdate";
object oClientname = "clientname";
object oClientsname = "clientsname";
object oAsondate = "asondate";
object oAmount = "amount";
myWordApp.Visible = false;
myWordDoc = myWordApp.Documents.Add(ref filename, ref nothing, ref nothing, ref nothing);
myWordDoc.Activate();
myWordDoc.Bookmarks.get_Item(ref oPrintdate).Range.Text = System.DateTime.Now.ToShortDateString();
myWordDoc.Bookmarks.get_Item(ref oClientname).Range.Text = objproperty.firstname +"" + objproperty.lastname;
myWordDoc.Bookmarks.get_Item(ref oAmount).Range.Text = "10000";
myWordDoc.SaveAs(ref destination, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing,
ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing);
myWordDoc.Close(ref destination, ref filename, ref nothing);
Response.ContentType = "application/msword";
myWordApp.Application.Quit(ref nottrue, ref nothing, ref nothing);
Response.WriteFile("E:\\new.doc");
Response.End();
> Blockquote