Exists Property

Microsoft Publisher Visual Basic

Show All Show All

Exists Property

ShowAs it applies to the BorderArtFormat object.

True if the specified BorderArtFormat object exists. Read-only Boolean.

expression.Exists()

expression    Required. An expression that returns a BorderArtFormat object.

ShowAs it applies to the PageBackground object.

True if the specified PageBackground object exists. Read/write Boolean.

expression.Exists

expression    Required. An expression that returns a PageBackground object.

Example

As 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
      

As it applies to the PageBackground object.

The following example tests for the existence of a background on the first page of the active document. If a background does not exist, one is created.

        If ActiveDocument.Pages(1).Background.Exists = False Then
    ActiveDocument.Pages(1).Background.Create
End If