Reply
 
Thread Tools Display Modes
  #1   Report Post  
John Calligy
 
Posts: n/a
Default Saving form letters individually

Working with Windows 2000 and Word 2000

After merging a form letter, I would like to save each letter individually
(i.e., letter to Mr. Smith as "Smith lettter.doc", letter to Mr. Jones as
"Jones letter.doc", etc.). What's the easiest way to do this?
  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

There's no built-in method. In the simple case where each letter corresponds
to one record in the data source you could try adapting and running the
following Word VBA macro to do one merge for each record in the data source:

Sub ProduceOneDocPerSourceRec()
' NB, needs better error management and doubtless other things a VBA expert
' will point out.
Dim intSourceRecord
Dim objMerge As Word.MailMerge
Dim strOutputDocumentName As String
Dim TerminateMerge As Boolean

' Need to set up this object as the ActiveDocument changes when the ' merge
is performed. Besides, it's clearer.

Set objMerge = ActiveDocument.MailMerge
With objMerge

' If no data source has been defined, do it here using OpenDataSource.
' But if it is already defined in the document, you should not need to
define it here.

' .OpenDataSource _
' Name:="whatever"

intSourceRecord = 1
TerminateMerge = False

Do Until TerminateMerge
..DataSource.ActiveRecord = intSourceRecord

' if we have gone past the end (and possibly, if there are no records)
' then the Activerecord will not be what we have just tried to set it to

If .DataSource.ActiveRecord intSourceRecord Then
TerminateMerge = True
' the record exists
Else

' while we are looking at the correct activerecord,
' create the document path name
' e.g. something like the following, but in this case
' each lastname must be unique (and must not contain
' charters that are not allowed in a file name)
strOutputDocumentName = _

"c:\mymergeletters\_" & _
..DataSource.Datafields("lastname").Value & _
" letter.doc"
..DataSource.FirstRecord = intSourceRecord
..DataSource.LastRecord = intSourceRecord
..Destination = wdSendToPrinter 'please check the constant name
..Execute

' The Activedocument is always the output document
' Add any parameters you need to these calls
ActiveDocument.SaveAs strOutputDocumentName
ActiveDocument.Close
intSourceRecord = intSourceRecord + 1
End If
Loop
End With
End Sub

Peter Jamieson
"John Calligy" wrote in message
...
Working with Windows 2000 and Word 2000

After merging a form letter, I would like to save each letter individually
(i.e., letter to Mr. Smith as "Smith lettter.doc", letter to Mr. Jones as
"Jones letter.doc", etc.). What's the easiest way to do this?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I spellcheck the text entered into a locked form? Missy Microsoft Word Help 1 January 20th 05 05:20 PM
form letters from word 97 to word 2003 kimmy1004 Microsoft Word Help 2 January 11th 05 04:59 AM
Table Gridlines in Word 2003 Form Linda L Tables 1 January 5th 05 10:52 PM
Text Form Field Ref in Footer Won't Update on Screen StarWine Microsoft Word Help 3 December 6th 04 06:17 PM
Form Field Automation Mitch Microsoft Word Help 2 November 29th 04 07:29 PM


All times are GMT +1. The time now is 07:02 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"