Labels Collection

Microsoft Publisher Visual Basic

Labels Collection

PageSetup Labels
Label

Contains a collection of Label objects, which represent the unique label designs available on the system.

Using the Labels collection

Each label design available on the system resides in the AvailableLabels collection. Use the AvailableLabels property on the PageSetup object to return the collection of Label objects that are available on the system.

The following example uses the AvailableLabels property to populate the Labels collection with the lables that are available in the active document. A test is then run on each label in the collection, and the name of the label is displayed if the label's height is greater than 4 inches.

Dim theLabel As Label
Dim theLabels As Labels

Set theLabels = ActiveDocument.PageSetup.AvailableLabels

For Each theLabel In theLabels
    If theLabel.Height > InchesToPoints(4) Then
        MsgBox theLabel.Name
    End If
Next theLabel