RemoveCatalogMergeArea Method

Microsoft Publisher Visual Basic

Show All Show All

RemoveCatalogMergeArea Method

Deletes the catalog merge area from the specified publication page. All shapes contained in the catalog merge area remain in place on the page, but are no longer connected to the catalog merge data source.

expression.RemoveCatalogMergeArea

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

Remarks

Removing a catalog merge area from a publication page does not disconnect the data source from the publication. Use the IsDataSourceConnected property of the Document object to determine if a data source is connected to a publication.

Use the AddCatalogMergeArea method of the Shapes collection to add a catalog merge area to a publication. A publication page can contain only one catalog merge area.

Example

The following example tests whether any page in 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