Formatting special characters within a module for a Word Mail merge.

C

CES

All,
I am having problems with a field that I am exporting to a Microsoft Word Mail merge. Basically the gist of the module is it loops through a database table and finds all residents who live at a specific address and then exports each name, that it encounters to a string ie: [name] vbCrLf [Name] vbCrLf {etc}, (you can find the code below). So far so good . However I am encountering a problem once the field is formatted in Word using align center, the first name in the spring is justified right,
and each successive names in the string are justified center. I’ve tried adding vbCrLf prior to the first name, however, I am still getting the same formatting problem. I was hoping that someone might be able to help me with this problem. Thanks in advance. - CES


Do While Not .EOF

If strTmp = .Fields("aStreetNum") & .Fields("aStreetName") & .Fields("aAptNum") & .Fields("aZip") Then

If x > 0 Then
strToReturn = strToReturn & vbCrLf
End If

If .Fields("cFName") <> "" Then
name = .Fields("cFName") & " "
End If
If .Fields("cMName") <> "" Then
name = name & .Fields("cMName") & " "
End If
If .Fields("cLName") <> "" Then
name = name & .Fields("cLName") & " "
End If

strToReturn = strToReturn & name
x = x + 1
End If

.MoveNext
Loop
 
D

Dave Lett

Hi,

If this is formatting problem and you are using styles, then you can add the
following line to your routine.

ActiveDocument.Range.Font.Reset

This will remove all direct formatting from the text in your docment.

HTH,
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top