View Single Post
  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michael Koerner Michael Koerner is offline
external usenet poster
 
Posts: 41
Default Merging to A, B,C...

Peter;

You macro to me looks like it is for a letter, will try it out, But, my need
is for envelopes, and has to have the following. this is taken from the
template file after it confirms the source of the data.

First Name Last Name
Address1
Address2
City Prov
Zip
Country

--

Regards
Michael Koerner


"Peter Jamieson" wrote in message
...
You can try a macro like

Sub OneMergePerInitialLetter()
' error trapping to be added
Dim iLetter As Integer
Dim objMMMD As Word.Document
dim strSheetName As String
dim strColumnName
' Set this to the name of the worksheet or to the range name
strSheetName = "Sheet1$"

' Set this to the exact name of the column containing the name
' (upper/lower case is probably significant
strColumnName = "mycolumn"

Set objMMMD = ActiveDocument
With objMMMD
For iLetter = Asc("A") To Asc("Z")
.MailMerge.DataSource.QueryString = _
" SELECT * FROM [Sheet1$]" & _
" WHERE ucase(t) like '" & Chr(iLetter) & "%'"
With .MailMerge
' remove or change this as necessary
.Destination = wdSendToNewDocument
.Execute Pause:=False
End With
If MsgBox("Completed Letter " & Chr(iLetter) & _
". Do the next letter?", vbOKCancel) = vbCancel Then
Exit For
End If
Next
End With
Set objMMMD = Nothing
End Sub

See e.g. Graham Mayor's page at
http://www.gmayor.com/installing_macro.htm
if you need help on installing and running macros.

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

Michael Koerner wrote:
Peter;

Thanks very much what you posted is what I'm looking for only I don't know
how to use what you posted.

The second part was to select the records in 100 record increments to
create
the merge documents. Different than selecting from the Alpha characters.