We don't use US barcodes in the UK and to experiment with them would need me
to setup my PC in US format, which I have not done, however if my
understanding of how the barcode works is correct, the following
modification to the macro used to insert addresses from Outlook (and
included in my envelope templates) *should* add a barcode field to the end
of the address.
From what I can gather the barcode field will use the bookmarked address to
compile the barcode. If that is correct, then the following should work as
the macro bookmarks the address and and inserts a barcode field with that
bookmarked content.
Near the bottom where the address is being selected you will see Count:=3 .
You may have to change that to Count:=2.
Let me know how you get on with this for if it works I will add the code to
the web page for the benefit of US users.
I have also bounced this to fellow MVP Greg Maxey who may be persuaded to
test it for me
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Public Sub InsertAddressFromOutlook()
Dim strCode, strAddress As String
Dim iDoubleCR As Integer
'Set up the formatting codes in strCode
strCode = "<PR_GIVEN_NAME> <PR_SURNAME>" & vbCr
strCode = strCode & "<PR_COMPANY_NAME>" & vbCr
strCode = strCode & "<PR_POSTAL_ADDRESS>" & vbCr
'Let the user choose the name in Outlook
strAddress = Application.GetAddress("", strCode, False, 1, , , True,
True)
'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 address
Selection.TypeText strAddress
'Select the address block
Selection.MoveUp Unit:=wdLine, Count:=3, Extend:=wdExtend
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="sZip"
'Move to the end of the address and add the barcode
Selection.EndKey Unit:=wdStory
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"BARCODE sZip \b", PreserveFormatting:=True
End Sub