WD: Text Form Fields Not Retained During Mail Merge

ID: Q146644

The information in this article applies to:

SYMPTOMS

A mail merge main document that contains form fields retains the drop-down and check box form fields, but text form fields are not present in the merge result.

CAUSE

Word unlinks the text form fields during the mail merge. Word does not unlink display form fields, such as the drop-down and the check box form fields. This behavior is by design.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/

Instead of inserting text form fields into the mail merge main document, insert a placeholder, merge to a new document, and then replace the placeholder with the text form field. Use the following macro to replace the placeholder with a text form field.

NOTE: The drawback to this method is that you cannot merge directly to a printer; you must merge to a document, run the macro and then print the document.

   Sub MAIN
      StartOfDocument
      ' Turn screen updating off.
      ScreenUpdating 0
      ' Note that "<TEXTFIELD>" (below) needs to be whatever the user has
      ' as a temporary text form field "replacement" in their original
      ' merge document.
      EditFind .Find = "<TEXTFIELD>", .Direction = 0, .Wrap = 1
      ' This makes sure that there are actually more "fields" to replace
      ' before putting in a new form field. Without this it would endlessly
      ' insert text form fields at the end of the document.
      While EditFindFound()
        InsertFormField .Enable = 1, .TextType = 0, .TextWidth = "0"
        EditFind
      Wend
      ScreenUpdating 1   'Turn screen updating back on.
      StartOfDocument
   End Sub

MORE INFORMATION

Some fields, such as the Next and FillIn fields require input either from the data document or from you to continue processing the merge. In this case, Word places the results in the merged document. However, fields that obtain information from document statistics, such as the Numpages field, may be inappropriate for a merged document. As a result they are not retained in the merge result.

The following table lists which fields are not unlinked and which fields are unlinked during a Word mail merge.

   Fields that are                   Fields that are
   not unlinked                      unlinked
   -------------------------------------------------

   = (Formula)                       Ask
   Advance                           Author
   AutoNum                           AutoText
   AutoNumLgl                        AutoTextList
   AutoNumOut                        Comments
   BarCode                           Compare
   Date                              CreateDate
   EQ                                Database
   FormCheckbox                      DocProperty
   FormDropDown                      DocVariable
   GotoButton                        EditTime
   IncludePicture                    FileName
   IncludeText                       FileSize
   Link                              FillIn
   MacroButton                       Hyperlink
   NoteRef                           If
   Page                              Index
   PageRef                           Info
   Print                             Keyword
   PrintDate                         LastSavedBy
   Private                           ListNum
   RD                                Mergefield
   Section (See NOTE)                MergeRec
   SectionPages                      MergeSeq
   Symbol                            Next
   TA                                NextIf
   TC                                NumChars
   Time                              NumWords
                                     Quote
                                     Ref
                                     RevNum
                                     SaveDate
                                     Seq
                                     Set
                                     SkipIf
                                     StyleRef
                                     Subject
                                     Template
                                     Title
                                     TOA
                                     TOC
                                     UserAddress
                                     UserInitials
                                     UserName

NOTE: The Section field in Word for the Macintosh version 6.0 and 6.0.1 will be unlinked.

Additional query words: text form mail merge mailmerge lost stripped removed disappear print merge merging display field formfield drop down dropdown

Keywords          : kbdtacode wordnt kbmacroexample kbfield winword kbmerge ntword macword word6 word7 word95 macword6 
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH Win95 WINDOWS winnt
Issue type        : kbbug kbinfo

Last Reviewed: April 9, 1999