Success! The problem was in the original document. After the person's name
there was a tab and then more information. I didn't realize that Word would
cound Tab and Enter as a character rather than a series of blank spaces. I
changed the original document so that after the person's name is on a line by
itself and use the space bar to give me extra space to account for people
with really long names.
This is going to save me so much time. Thanks for your help.
Suzanne,
One of the easy and correct ways to format white space in Word is to use
tabs instead of multiple, varying amounts of spaces (more work than you
need).
You can use the replace command to remove tab characters from a string and I
would also use a Trim() function for good measure, to trim any leading or
trailing spaces.:
StrName = Trim(Replace( ActiveDocument.Range(7, 50).Text, vbTab, ""))
> Success! The problem was in the original document. After the person's name
> there was a tab and then more information. I didn't realize that Word would
[quoted text clipped - 89 lines]
>>>>>>> ActiveDocument.Close savechanges:=wdDoNotSaveChanges
>>>>>>> End Sub

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Russ - 19 Oct 2007 07:10 GMT
Suzanne,
Another way to do it, if you **always** have the first tab character after
the name:
StrName = ActiveDocument.Paragraphs(1).Range.Text
StrName = Trim(Mid(StrName, 6, InStr(StrName, vbTab) - 6))
The first number 6 trims off the text "Name: "
The second number 6 just adjusts the character number where the tab
character was found because you did trim off the first six characters.
> Suzanne,
> One of the easy and correct ways to format white space in Word is to use
[quoted text clipped - 99 lines]
>>>>>>>> ActiveDocument.Close savechanges:=wdDoNotSaveChanges
>>>>>>>> End Sub

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Russ - 19 Oct 2007 07:23 GMT
Suzanne,
Actually the numbers should be 7 and 7 to ignore the space character after
"Name:".
StrName = ActiveDocument.Paragraphs(1).Range.Text
StrName = Trim(Mid(StrName, 7, InStr(StrName, vbTab) - 7))
> Suzanne,
> Another way to do it, if you **always** have the first tab character after
[quoted text clipped - 111 lines]
>>>>>>>>> ActiveDocument.Close savechanges:=wdDoNotSaveChanges
>>>>>>>>> End Sub

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID