2 Replies Latest reply on Mar 25, 2007 5:22 PM by fforesite

    Creating mail merge application using Word

    fforesite
      Hi,

      We are in the process in developing a coldfusion web application that enables user to upload Word document and a data source for mail merge.

      After spending few hours googling, we are still unable to find a definite solution. Does anyone give us a pointer on how we might be able to achieve this? Can coldfusion maybe by using Java be able to access Microsoft's Office objects?

      Your help will be truly appreciated.
        • 1. Re: Creating mail merge application using Word
          Karthik_Nataraj Level 1
          Use the <cfobject> tag of coldfusion to create the below objects of word application (you should have Microsoft word installed in your cf server).
          Word.Application
          Word.Document
          Word.MailMerge

          Then you can follow the same steps how you do a VB program to create the Word MailMerge in ColdFusion. A sample vb code is give below,

          Dim oWordApp As New Word.Application
          Dim WrdDoc As Word.Document
          Dim wrdMailMerge As Word.MailMerge

          Set WrdDoc = oWordApp.Documents.Open("template path", ReadOnly:=True)
          Set wrdMailMerge = WrdDoc.MailMerge
          wrdMailMerge.OpenDataSource Name:="file path", Format:="format", ConfirmConversions:=True
          wrdMailMerge.Destination = wdSendToNewDocument
          wrdMailMerge.Execute
          oWordApp.ActiveDocument.SaveAs FileName:="full path & name", FileFormat:="format"

          Set oWordApp = Nothing
          • 2. Re: Creating mail merge application using Word
            fforesite Level 1
            Thanks for your help, I will try to implement your suggestion.