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 ShapeNow you can change the standard properties (e.g. height, width) of the OLE object using the properties of the variable "ab":
Set ab = Application.ActiveWindow.View.Slide.Shapes.AddOLEObject(Left:=100,
Top:=100, Width:=300, Height:=150, ClassName:="ACTIVEBARCODE.BarcodeCtrl.1")
ab.Width = 200You can access the properties and methods of the barcode object using the "OLEFormat.Object" property. Here are a few examples:
ab.Height = 120
ab.OLEFormat.Object.Type = 6If you no longer need the control within the macro/slide (for example, after printing), you can easily remove it:
ab.OLEFormat.Object.Text = "987698769812"
ab.OLEFormat.Object.Rotate = 90
ab.DeleteHint: 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:
DoEventsThis may be necessary, for example, if the control needs to redraw itself.