Intelligent Mail Barcode in Microsoft Excel
Requirements
- Download and install the barcode generator
IMB Barcode Data Structure
To make yourself familiar with the IMB data structure, read the guide about making IMB in Word.

Intelligent Mail Barcode in Microsoft Excel
1. Press Alt+F11 to open the VBA window.
2. Double-click your current worksheet in the project tree.
3. Paste the code into the editor:
Sub Make_IMB()
On Error Resume Next
Shapes("IMB").Delete
On Error GoTo 0
BarcodeID = "72"
ServiceID = "367"
MailerID = "219931914"
Serial = "949452"
RoutingCode = "457875197"
Dim sh As Shape
Set sh = ActiveSheet.Shapes.AddOLEObject("STROKESCRIBE.StrokeScribeCtrl.1")
sh.Name = "IMB"
sh.LockAspectRatio = msoFalse
sh.Height = Application.InchesToPoints(0.145) ' The fixed height of the IMB
sh.Width = Application.InchesToPoints(3) ' The fixed width of the IMB
sh.Left = Application.InchesToPoints(1) ' The left/top position of the IMB on the worksheet
sh.Top = Application.InchesToPoints(1) ' Change these two values per your needs
Dim o As Object
Set o = sh.OLEFormat.Object.Object
o.Alphabet = 28
o.HBorderSize = 0
o.VBorderPercent = 0
o.Text = BarcodeID & ServiceID & MailerID & Serial & RoutingCode
If o.ss.Error Then
MsgBox o.ErrorDescription
End If
End Sub
4. Place the caret into the Make_IMB() sub body and press F5 to run the code.
5. Switch to the Excel window to see the barcode.
Related Tutorials
- Barcode in Microsoft Excel with ActiveX
- Using Formula to Create Barcode in Excel
- Using DLL version of the barcode generator in Excel
© 2025 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.