RemoveFromCatalogMergeArea Method

Microsoft Publisher Visual Basic

Show All Show All

RemoveFromCatalogMergeArea Method

Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.

expression.RemoveFromCatalogMergeArea

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area.

Use the RemoveCatalogMergeArea method of the Shape object to remove the catalog merge area from a publication page, but leave the shapes it contains.

Example

The following example tests whether any page of the specified publication contains a catalog merge area. If any page 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