See the use of macrobutton fields to insert addresses from Outlook
http://www.gmayor.com/Macrobutton.htm and substitute the following code for
that produced there.
Public Sub InsertAddressFromOutlook()
Dim strCode, strAddress As String
Dim iDoubleCR As Integer
'Set up the formatting codes in strCode
strCode = "<PR_DISPLAY_NAME>" & vbCr
strCode = strCode & "<PR_COMPANY_NAME>" & vbCr
strCode = strCode & "<PR_STREET ADDRESS>" & vbCr
strCode = strCode & "<PR_LOCALITY>, <PR_STATE_OR_PROVINCE>" _
< PR_POSTAL_CODE > " & vbCr"
strCode = strCode & "<PR COUNTRY>" & vbCr
'Let the user choose the name in Outlook
strAddress = Application.GetAddress _
("", strCode, False, 1, , , True, True)
'Strip away the final "United States of America", if any
If Right(strAddress, 25) = "United States of America" & vbCr 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
'Insert the modified address at the current insertion point
Selection.TypeText strAddress
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>