Delete Method

Microsoft Publisher Visual Basic

Deletes the specified plate.

expression.Delete(PlateReplaceWith, ReplaceTint)

expression    Required. An expression that returns a Plate object.

PlateReplaceWith   Optional Plate. The plate with which to replace the deleted plate.

ReplaceTint   Optional pbReplaceTint.

ReplaceTint can be one of these pbReplaceTint constants.
pbReplaceTintKeepTints Maintain the same tint percentage in the ink represented by the replacement plate as in the deleted plate. For example, replace a 100% tint of yellow with a 100% tint of blue.
pbReplaceTintMaintainLuminosity Maintain the same lightness value in the ink represented by the replacement plate as in the deleted plate. For example, replace a 100% tint of yellow with an approximately 10% tint of blue.
pbReplaceTintUseDefault Default

Remarks

Returns "Permission Denied" if you attempt to delete the last plate in the Plates collection.

If the pbReplaceTintMaintainLuminosity constant is specified, the percentage of replacment ink in each color is calculated based on the luminosity values of the inks represented by the deleted and replacement plates. Publisher performs the following calculation, where L1 is the deleted ink luminosity, and L2 is the replacement ink luminosity: (100-L1)/(100-L2).

For example, red ink has a luminosity of 30, and black has a luminosity of 0. Suppose you replaced the red ink plate in a publication with a black ink plate. If pbReplaceTintKeepTints is specified, Publisher performs the following calculation to determine the percentage of black ink for each red color: (100-30)/(100-0). A color that was 100% red would now be 70% black; a color that was 50% red would now be 35% black, and so on.

If the pbReplaceTintKeepTints constant is specified, the percentage of the replacement ink in each color is the same as the deleted color. For example, if red ink is replaced with black ink, 100% tint of red is replaced by 100% tint of black, 50% red with 50% black, and so on.

You cannot specify the pbReplaceTintMaintainLuminosity or pbReplaceTintUseDefault constants if the replacement plate represents an ink that has a higher luminosity (that is, is lighter) than the deleted plate. This is because the lighter ink can not be printed at more than 100%, so it will not be able to match the luminosity of the darker ink.

ShowDelete method as it applies to the ShapeNodes object.

Deletes the specified shape node object.

expression.Delete(Index)

expression    Required. An expression that returns a ShapeNodes collection.

Index   Required Long. The number of the shape node to delete.

ShowDelete method as it applies to the WebHiddenFields and WebListBoxItems objects.

Deletes the specified hidden Web field or Web list box item object.

expression.Delete(Index)

expression    Required. An expression that returns one of the above objects.

Index   Required Long. The number of the Web field or list box item to delete.

ShowDelete method as it applies to all the other objects in the Applies To list.

Deletes the specified object.

expression.Delete

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

Remarks

A run-time error occurs if the specified object does not exist.

Example

ShowAs it applies to the BorderArtFormat object.

The following example tests for the existence of BorderArt on each shape for each page of the active publication. If BorderArt exists, it is deleted.

Sub DeleteBorderArt()

Dim anyPage As Page
Dim anyShape As Shape

For Each anyPage in ActiveDocument.Pages
		For Each anyShape in anyPage.Shapes
			With anyShape.BorderArt
				If .Exists = True Then
					.Delete
				End If
			End With
		Next anyShape
	Next anyPage
End Sub

ShowAs it applies to the Plate object.

The following example loops through the active publication's plates collection, determines which plates represent inks not used in the publication, and deletes them. This example assumes that at least one of the plates is in use (the Delete method returns "Permission Denied" if you attempt to delete the last plate in the collection.)

Sub DeleteUnusedInks()
    
Dim intCount As Integer
    
With ActiveDocument.Plates
    For intCount = .Count To 1 Step -1
        With .Item(intCount)
            If .InUse = False Then
                Debug.Print "Name: " & .Name
                .Delete
            End If
        End With
    Next
End With

End Sub

ShowAs it applies to the ShapeNodes object.

This example deletes the first node in the first shape in the active publication.

Sub DeleteNode()
    ActiveDocument.Pages(1).Shapes(1).Nodes.Delete Index:=1
End Sub
				

ShowAs it applies to the Shapes object.

This example deletes the first shape in the active publication.

Sub DeleteShape()
    ActiveDocument.Pages(1).Shapes(1).Delete
End Sub