CatalogMergeShapes object (Publisher)
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 than 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 that you have inserted in addition to other design elements that you choose.
Use the CatalogMergeItems property of the Shape or ShapeRange objects to return the contents of the catalog merge area.
Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area.
Use CatalogMergeItems (index), where index is the index number, to return a single catalog merge area shape.
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.
Example
The following example tests whether the specified publication contains a catalog merge area. If it does, it returns a list of the shapes that it contains.
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.CatalogMergeItems.Item(intCount).ID
Debug.Print "Shape Name: " & _
mmLoop.CatalogMergeItems.Item(intCount).Name
Next
End With
End If
Next mmLoop
Next pgPage
End Sub
The following example adds a rectangle to the catalog merge area in the specified publication. This example assumes that a catalog merge area has been added to the first page of the publication.
ThisDocument.Pages(1).Shapes.AddShape(1, 80, 75, 450, 125).AddToCatalogMergeArea
The following example removes the first shape from the catalog merge area.
ThisDocument.Pages(1).Shapes(1).CatalogMergeItems(1).RemoveFromCatalogMergeArea
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.
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
Methods
Properties
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for