Remove United States of America from inside adress in Word 2002

G

Guest

I am using the letter wizard in Word to enter contacts from Outlook into a
saved letterhead file. It's adding United States of America at the end of
the address, even though I can't find that anywhere in the contact or the
letter wizard. Is there a way to remove that, without having to do it every
time I use the wizard?
 
G

Graham Mayor

If your regional setting in Windows is set to United States, the United
States shouldn't be added to inserted PostalAddress fields, however see
http://www.gmayor.com/Macrobutton.htm in conjunction with the following
modified macro:


Public Sub InsertAddressFromOutlook()
Dim strCode As String
Dim strCountry As String
Dim strAddress As String
Dim iDoubleCR As Integer

'Set up the formatting codes in strCode
strCode = "{<PR_DISPLAY_NAME_PREFIX> }<PR_GIVEN_NAME> <PR_SURNAME>" & vbCr
strCode = strCode & "<PR_COMPANY_NAME>" & vbCr
strCode = strCode & "<PR_POSTAL_ADDRESS>" & vbCr
strCountry = "<PR_COUNTRY>"

'Let the user choose the name in Outlook
strAddress = Application.GetAddress("", _
strCode, False, 1, , , True, True)
If strAddress = "" Then
MsgBox "User cancelled or no address listed", , "Cancel"
Exit Sub
End If
strCountry = Application.GetAddress("", strCountry, _
False, 2, , , True, True)

'Strip away the final "United States Of America", if any
If InStr(strCountry, "United States") Then
strAddress = Left(strAddress, Len(strAddress) - 25)
End If

'Eliminate blank lines by looking for two carriage returns in a row
iDoubleCR = InStr(strAddress, vbCr & vbCr)
While iDoubleCR <> 0
strAddress = Left(strAddress, iDoubleCR - 1) & _
Mid(strAddress, iDoubleCR + 1)
iDoubleCR = InStr(strAddress, vbCr & vbCr)
Wend
Selection.TypeText strAddress
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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