Intelligent Mail Barcode in Microsoft Word
Requirements
- Download and install the barcode generator
IMB Barcode Data Structure
Intelligent Mail Barcode Data Fields
There are two Intelligent Mail barcode constructions with different Mailer ID sizes.
A 6-digit Mailer ID and 9-digit Serial Number:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| Barcode ID | Service type ID | Mailer ID | Serial Number | Routing Code 0, 5, 9 or 11 digits | ||||||||||||||||||||||||||
| 00 | 700 | 333333 | 444444444 | 55555 | ||||||||||||||||||||||||||
| 00 | 702 | 003333 | 000044444 | 555555555 | ||||||||||||||||||||||||||
A 9-digit Mailer ID and 6-digit Serial Number:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| Barcode ID | Service type ID | Mailer ID | Serial Number | Routing Code | ||||||||||||||||||||||||||
| 00 | 702 | 333333333 | 000044 | 55555555555 | ||||||||||||||||||||||||||
Barcode Identifier - The field is reserved to encode the presort identification. Generally, should be left as 00 if an OEL (optional endorsement line) is not printed on the mailpiece:
- 00 - No OEL Information
- 20 - 5-Digit/Scheme
- 30 - 3-Digit/Scheme
- 40 - Area Distribution Center (ADC)
Read more about data fields and codes in USPS IMB Technical Resource Guide.
Service Type Identifier - A 3-digit field that indicates participation in Postal Service programs. Corresponds to a particular mail class with a particular combination of services:
- 700 - First-Class Mail with no services
- 702 - Standard Mail with no services
- 704 - Periodicals with no services
- 710 - Priority Mail with no services
- 712 - Priority Mail Flat Rate with no services
Mailer Identifier - A 6-digit or 9-digit customer identifier, shall be assigned by USPS.
How To: Mailer ID Application Process
Serial Number - A 6-digit or 9-digit field depending on the length of the Mailer ID. Can be populated with a number that uniquely identifies each mailpiece (Mailpiece ID) or mailing (Mailing ID).
Routing Code is an optional field, which may contain a 5-digit ZIP Code, a 9-digit ZIP+4 code, or an 11-digit delivery point code.
Intelligent Mail Barcode Physical Dimensions
Barcode width must be in the range of [2.667..3.225]in.
Barcode height must be in the range of [0.125..0.165]in.
In our examples below, we create 3x0.140 inch barcodes.
How to create Intelligent Mail Barcode in Microsoft Word
1. Press Alt+F11 to open the VBA window.
2. Double-click the ThisDocument item in the project tree.
3. Paste the code into the editor:
Sub CreateIMB()
BarcodeID = "72"
ServiceID = "367"
MailerID = "219931914"
Serial = "949452"
RoutingCode = "457875197"
Dim s As Shapes
Set s = ActiveDocument.Shapes
On Error Resume Next
s("IMB").Delete
On Error GoTo 0
Dim shape As shape
Set shape = s.AddOLEControl("STROKESCRIBE.StrokeScribeCtrl.1")
Dim o As Object
Set o = shape.OLEFormat.Object
shape.Name = "IMB"
shape.Height = InchesToPoints(0.145)
shape.Width = InchesToPoints(3)
shape.Left = InchesToPoints(1)
shape.Top = InchesToPoints(1)
o.HBorderSize = 0
o.VBorderPercent = 0
o.Alphabet = 28 ' 28=IMB
o.Text = BarcodeID & ServiceID & MailerID & Serial & RoutingCode
If o.Error Then
MsgBox o.ErrorDescription
End If
End Sub
Press F5 to run the code.
Related Tutorials
- Barcode in Microsoft Word
- Barcode Generation in Microsoft Word with StrokeScribe Class
- How To Modify, Move And Resize Barcode In Word with VBA
© 2026 StrokeScribe. All rights reserved. Use of any portion of this site constitutes acceptance of our Terms of Use and Privacy Policy. The website material may not be reproduced, except with the prior written permission.