BorderArtFormat Object

Microsoft Publisher Visual Basic

BorderArtFormat Object

Shape BorderArtFormat
ColorFormat

Represents the formatting of the BorderArt applied to the specified shape.

Using the BorderArtFormat Object

Use the BorderArt property of a shape to return a BorderArtFormat object.

The following example returns the BorderArt of the first shape on the first page of the active publication, and displays the name of the BorderArt in a message box.

    Dim bdaTemp As BorderArtFormat

Set bdaTemp = ActiveDocument.Pages(1).Shapes(1).BorderArt
MsgBox "BorderArt name is: " &bdaTemp.Name
  

Use the Set method to specify which type of BorderArt you want applied to a picture. The following example tests for the existence of BorderArt on each shape for each page of the active document. Any BorderArt found is set to the same type.

    Sub SetBorderArt()
Dim anyPage As Page
Dim anyShape As Shape
Dim strBorderArtName As String

strBorderArtName = Document.BorderArts(1).Name

	For Each anyPage in ActiveDocument.Pages
		For Each anyShape in anyPage.Shapes
			With anyShape.BorderArt
				If .Exists = True Then
					.Set(strBorderArtName)
				End If
			End With
		Next anyShape
	Next anyPage
End Sub
  

You can also use the Name property to specify which type of BorderArt you want applied to a picture. The following example sets all the BorderArt in a document to the same type using the Name property.

    Sub SetBorderArtByName()
Dim anyPage As Page
Dim anyShape As Shape
Dim strBorderArtName As String

	strBorderArtName = Document.BorderArts(1).Name

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

Note  Because Name is the default property of both the BorderArt and BorderArtFormat objects, you do not need to state it explicitly when setting the BorderArt type. The statement Shape.BorderArtFormat = Document.BorderArts(1) is equivalent to Shape.BorderArtFormat.Name = Document.BorderArts(1).Name.

Use the Delete method to remove BorderArt from a picture. The following example tests for the existence of border art on each shape for each page of the active document. If border art 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
  

Remarks

BorderArt are picture borders that can be applied to text boxes, picture frames, or rectangles.