Standard or higher

PowerPoint
Barcode objects with VBA

Using and automating barcodes with VBA in PowerPoint

1

You can easily solve many things with VisualBasic for Applications (VBA). Here we show you briefly, how to integrate the barcode object into a PowerPoint presentation using VBA, use it, and remove it again:

This is how to insert the ActiveBarcode Control into the active slide using VBA:
In this example, the barcode is placed at the specified position and size into the slide. The object can then be addressed via "ab":

Dim ab As Shape
Set ab = Application.ActiveWindow.View.Slide.Shapes.AddOLEObject(Left:=100,
Top:=100, Width:=300, Height:=150, ClassName:="ACTIVEBARCODE.BarcodeCtrl.1")
Now you can change the standard properties (e.g. height, width) of the OLE object using the properties of the variable "ab":
ab.Width = 200
ab.Height = 120
You can access the properties and methods of the barcode object using the "OLEFormat.Object" property. Here are a few examples:
ab.OLEFormat.Object.Type = 6
ab.OLEFormat.Object.Text = "987698769812"
ab.OLEFormat.Object.Rotate = 90
If you no longer need the control within the macro/slide (for example, after printing), you can easily remove it:
 ab.Delete
Hint: Should it be necessary for Windows to process pending events in a macro in between (often also called "KeepWindowsAlive"), you can force this by using the following VBA function:
DoEvents
This may be necessary, for example, if the control needs to redraw itself.