Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / October 2004

Tip: Looking for answers? Try searching our database.

Mail Merge with Form Fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lisa Harris - 12 Oct 2004 16:26 GMT
How can I create a document with form fields that can be
filled in post-merge?  

The merge form has form fields already in it.  With the
merge data toggled on, we can fill in the form fields,
print the forms, and they're perfect.   But if they're
saved and emailed to an outside party, the merge form is
looking for the data source, which doesn't exist on the
outside party's system.  

If I merge to a new document, the form fields are
obliterated.  Any way around this??  

Thanks for any input.

Lisa
Doug Robbins - 13 Oct 2004 00:02 GMT
Hi Lisa,

The two features are not compatible.  One reason for that is that each
bookmark in a document must have a unique name and when you execute the
merge, there would be multiple instances of each of the formfields and hence
of the bookmarks assigned to those fields.

You could however probably modify the following macro to insert formfields
into the merged document:

' Throwaway Macro created by Doug Robbins to "preserve" bookmarks during a
mailmerge
'
Dim abm As Bookmark, bmrange As Range, i As Long, Result As Document, j As
Long, k As Long
Dim Target As Document, Letter As Range, source As Document
Set source = ActiveDocument
i = 1
For Each abm In ActiveDocument.Range.Bookmarks
   System.PrivateProfileString("c:\bookmarks.txt", "bookmarkNames",
"bookmark" & i) = abm.Name
   abm.Range.InsertBefore "#"
   abm.Range.InsertAfter "#"
   i = i + 1
Next
With ActiveDocument.MailMerge
   .Destination = wdSendToNewDocument
   .Execute
End With
Set Result = ActiveDocument
For j = 1 To Result.Sections.Count - 1
   Set Letter = Result.Sections(j).Range
   Letter.End = Letter.End - 1
   Set Target = Documents.Add
   Target.Range = Letter
   k = 1
   Selection.HomeKey wdStory
   Selection.Find.ClearFormatting
   With Selection.Find
       Do While .Execute(FindText:="#*#", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True
           Set bmrange = Selection.Range
           bmrange.Characters(bmrange.Characters.Count).Delete
           bmrange.Characters(1).Delete
           Target.Bookmarks.Add
System.PrivateProfileString("c:\bookmarks.txt", "bookmarkNames", "bookmark"
& k), bmrange
           k = k + 1
       Loop
   End With
   Target.SaveAs FileName:="Letter" & j
   Target.Close
Next j
source.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
   Do While .Execute(FindText:="#*#", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True
       Set bmrange = Selection.Range
       bmrange.Characters(bmrange.Characters.Count).Delete
       bmrange.Characters(1).Delete
   Loop
End With

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> How can I create a document with form fields that can be
> filled in post-merge?
[quoted text clipped - 12 lines]
>
> Lisa
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.