Search code examples
c#ms-wordmailmergedocx-mailmerge

Mail merge without saving c#


I have use mail merge to word from instructor below. Now in last line it’s going to save the word file but I don’t want to save that I just want to open it without saving! What should I do for it? My mail merge instruction: https://vivekcek.wordpress.com/2012/08/25/create-a-word-document-from-a-template-using-c-mail-merge/


Solution

  • Should replace

    wordDoc.SaveAs("myfile.doc");
    wordApp.Documents.Open("myFile.doc");
    wordApp.Application.Quit();
    

    With

    wordApp.visible = true;
    wordApp.Activate();
    

    Now the word that has been merged didn’t require saving at first and it’s just like a draft.