
Making ISBN Barcode in Word
Requirements
- Download and install the barcode generator
Implementation Notes
The source data you provide to the barcode generator may look as follows:
- "ISBN 978-3-0348-0190-4"
- "978-3-0348-0190-4"
- "978303480190"
If the source data contains a check digit, the data integrity will be checked and error will be reported in case of check digit mismatch. If the source data comes with no check digit (only first 12 digits of ISBN-13 are specified), the check digit will be calculated automatically and no data integrity checks is performed.
The barcode generator checks the source data against the ISBN Agency's registration range rules. Numbers with unknown EAN prefixes, unknown or disabled registration groups or registrant ranges, will not be accepted.
Placing ISBN barcode in Word Using Active Document
1. Switch to the Insert tab on the Word Ribbon and click Object.
2. Look for the StrokeScribe Document:

3. Right-click the barcode object, select the StrokeScribe Control->Properties from the context menu.
Switch to the General tab in the barcode properties dialog;
Set Alphabet = ISBN;
Type a valid ISBN number in the Text field. For example: 978303480190.


How to Automate ISBN Placement Using VBA/ActiveX
The VBA code shown below places a 3x2cm ISBN barcode at the bottom-right corner of the last page of the Word document.
1. Open the VBA window (Alt+F11):

2. Paste the code into the ThisDocument module:
Sub MakeISBN()
Dim doc As Document
Set doc = Application.ActiveDocument
' This will create an anchor on the last page of the Word document
Dim lastpage As Range
Set lastpage = doc.Range.GoTo(What:=wdGoToPage, Which:=wdGoToLast)
Dim sh As Shape
Set sh = doc.Shapes.AddOLEObject _ ' The barcode will be placed on the last document page
(ClassType:="STROKESCRIBE.StrokeScribeCtrl.1", Anchor:=lastpage)
With doc.PageSetup ' The text area is the paper area minus margins
usable_w = .PageWidth - .RightMargin - .LeftMargin
usable_h = .PageHeight - .TopMargin - .BottomMargin
End With
sh.LockAspectRatio = msoFalse
sh.Width = CentimetersToPoints(3)
sh.Height = CentimetersToPoints(2)
sh.Left = usable_w - sh.Width
sh.Top = usable_h - sh.Height ' The barcode is placed just above the bottom paper margin
Dim ss As StrokeScribe
Set ss = sh.OLEFormat.Object
ss.Alphabet = ISBN
ss.Text = "978303480190"
If ss.Error Then
MsgBox ss.ErrorDescription
sh.Delete
End If
End Sub
3. Add a reference to the StrokeScribe ActiveX Control into your VBA project.
4. Move the caret into the Sub MakeISBN body and press F5.