A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Greeting line for contacts with two names



 
 
Thread Tools Display Modes
  #1  
Old August 19th, 2009, 08:59 PM posted to microsoft.public.word.mailmerge.fields
Portagepa
external usenet poster
 
Posts: 6
Default Greeting line for contacts with two names

If I have a couple with different last names as a Contact (Nancy Smith and
Don Jones); any way to pick the first names up correctly in the Greeting line
in a mail merge? (Dear Nancy and Don).
  #2  
Old August 19th, 2009, 10:35 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Greeting line for contacts with two names

Depends upon exactly what fields you have in the data source for the names
of the people. Can you tell us what they are?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Portagepa" wrote in message
...
If I have a couple with different last names as a Contact (Nancy Smith and
Don Jones); any way to pick the first names up correctly in the Greeting
line
in a mail merge? (Dear Nancy and Don).


  #3  
Old August 19th, 2009, 10:41 PM posted to microsoft.public.word.mailmerge.fields
Portagepa
external usenet poster
 
Posts: 6
Default Greeting line for contacts with two names

Coming from Outlook (2007); both names in the "Full Name" line.

"Doug Robbins - Word MVP" wrote:

Depends upon exactly what fields you have in the data source for the names
of the people. Can you tell us what they are?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Portagepa" wrote in message
...
If I have a couple with different last names as a Contact (Nancy Smith and
Don Jones); any way to pick the first names up correctly in the Greeting
line
in a mail merge? (Dear Nancy and Don).



  #4  
Old August 20th, 2009, 02:27 AM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Greeting line for contacts with two names

It is not possible to parse such a field in Word. You would have to make
use of (and enter the desired greeting line data) into one of the other
fields (nickname is one that you could use) that are available in Outlook.

The only other way would be to execute the merge to a new document and then
use a macro to go through that document, setting a Range object to the
..Range of the paragraph that contains the data from the Full Name field and
modifying the text in that field. The following code will do that if the
FullName mergefield is the only thing in the First Paragraph of the
mailmerge main document. (It prepends the names with the "Dear ", so it is
not necessary to have that in the mail merge main document

Dim i As Long
Dim fullname As Range
Dim Name2 As Range
Dim fname1 As Range, fname2 As Range
With ActiveDocument
For i = 1 To .Sections.Count
Set fullname = .Sections(i).Range.Paragraphs(1).Range
If InStr(fullname, " and ") 0 Then
Set Name2 = fullname.Duplicate
Set fname1 = fullname.Duplicate
Name2.Start = Name2.Start + InStr(Name2, "and") + 3
Set fname2 = Name2.Duplicate
If fullname.Words(2) = "-" Then
fname1.End = fullname.Words(3).End
Else
fname1.End = fullname.Words(1).End
End If
If Name2.Words(2) = "-" Then
Name2.End = Name2.Words(3).End
Else
Name2.End = Name2.Words(1).End
End If
fullname.Text = "Dear " & fname1 & "and " & Name2
Else
Set fname1 = fullname.Duplicate
If fullname.Words(2) = "-" Then
fname1.End = fullname.Words(3).End
Else
fname1.End = fullname.Words(1).End
End If
fullname.Text = "Dear " & fname1
End If
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Portagepa" wrote in message
...
Coming from Outlook (2007); both names in the "Full Name" line.

"Doug Robbins - Word MVP" wrote:

Depends upon exactly what fields you have in the data source for the
names
of the people. Can you tell us what they are?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Portagepa" wrote in message
...
If I have a couple with different last names as a Contact (Nancy Smith
and
Don Jones); any way to pick the first names up correctly in the
Greeting
line
in a mail merge? (Dear Nancy and Don).




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.