Share via


CatalogMergeShapes Object

Publisher Developer Reference

Represents the shapes contained in the catalog merge area of the specified publication.

Remarks

The catalog merge area is automatically resized to accommodate objects that are larger then the merge area, or that are positioned outside the catalog merge area when they are added.

Shapes inside the catalog merge area are automatically resized or repositioned if the catalog merge area is decreased in size or moved.

The catalog merge area can contain picture and text data fields you have inserted, in addtion to other design elements you choose.

Example

Use the CatalogMergeItems property of the Shape or ShapeRange objects to return the contents of the catalog merge area. The following example tests whether the specified publication contains a catalog merge area. If it does, it returns a list of the shapes it contains.

Visual Basic for Applications
  Sub ListCatalogMergeAreaContents()
 
    Dim pgPage As Page
    Dim mmLoop As Shape
    Dim intCount As Integer
For Each pgPage In ThisDocument.Pages
    For Each mmLoop In pgPage.Shapes

        If mmLoop.Type = pbCatalogMergeArea Then

            With mmLoop.CatalogMergeItems
                For intCount = 1 To .Count
                    Debug.Print "Shape ID: " & _
                        mmLoop.<strong class="bterm">CatalogMergeItems</strong>.Item(intCount).ID
                    Debug.Print "Shape Name: " &amp; _
                        mmLoop.CatalogMergeItems.Item(intCount).Name
                Next
            End With

        End If

    Next mmLoop
Next pgPage

End Sub

Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area. The following example adds a rectangle to the catalog merge area in the specified publication. This example assumes a catalog merge area has been added to the first page of the publication.

Visual Basic for Applications
  ThisDocument.Pages(1).Shapes.AddShape(1, 80, 75, 450, 125).AddToCatalogMergeArea

Use CatalogMergeItems(index), where index is index number, to return a single catalog merge area shape. The following example removes the first shape from the catalog merge area.

Visual Basic for Applications
  ThisDocument.Pages(1).Shapes(1).CatalogMergeItems(1).RemoveFromCatalogMergeArea

Use the RemoveFromCatalogMergeArea method of the Shape or ShapeRange objects to remove shapes from a catalog merge area. Removed shapes are not deleted, but are instead placed on the publication page containing the catalog merge area. The following example tests whether the specified publication contains a catalog merge area. If it does, all the shapes are removed from the catalog merge area and deleted, and the catalog merge area is then removed from the publication.

Visual Basic for Applications
  Sub DeleteCatalogMergeAreaAndAllShapesWithin()
    Dim pgPage As Page
    Dim mmLoop As Shape
    Dim intCount As Integer
    Dim strName As String
    
        For Each pgPage In ThisDocument.Pages
            For Each mmLoop In pgPage.Shapes
            
                If mmLoop.Type = pbCatalogMergeArea Then
                    With mmLoop.CatalogMergeItems
                        For intCount = .Count To 1 Step -1
                            strName = mmLoop.CatalogMergeItems.Item(intCount).Name
                            .Item(intCount).RemoveFromCatalogMergeArea
                            pgPage.Shapes(strName).Delete
                        Next
                    End With
                mmLoop.RemoveCatalogMergeArea
                End If
                
            Next mmLoop
        Next pgPage
       
 End Sub

See Also