Version 5.56 | Index Print view


Word - Working with VBA

Using ActiveBarcode with VBA in Word

You can use VisualBasic for Applications (VBA) to solve many things in Word. Here we will show you how to embed, use and delete the ActiveBarcode control with VBA:

Embedding the ActiveBarcode Control into a document:
In this example a barcode control will be placed at the cursors position. Then you can modify the object using the variable 'ab':

Set ab = Selection.InlineShapes.AddOLEObject(ClassType:="BARCODE.BarcodeCtrl.1",
FileName:="", LinkToFile:=False, DisplayAsIcon:=False)
To get access to the properties of the ActiveBarcode control we also create a variable named 'abObject':
With ab.OLEFormat
.Activate
Set abObject = .Object
End With
Set the standard properties (height, width) of the object using the variable 'ab':
ab.Width = 200
ab.Height = 120
Set the properties of the ActiveBarcode control using the 'abObject' variable:
abobject.Type = 6
abObject.Text = "987698769812"
If you do not need the control anymore you can delete it from the document:
 ab.Delete
Hint: If it's necessary that Windows process upcoming events (often named as "KeepWindowsAlive") within a macro, you can force this by using the following VBA function:
DoEvents
This can be necessary, e.g. if the Control must draw itself anew.




| Home | Shop | Email | Datenschutz | Sitemap | © Lars Schenk & Frank Horn

All trademarks and product names mentioned are the property of their respective owners.

ActiveBarcode:
Barcode OCX and Software
The complete solution for all popular barcode types
www.ActiveBarcode.com