BorderArtFormat Object

Publisher Developer Reference

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

Remarks

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

Example

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.

Visual Basic for Applications
  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.

Visual Basic for Applications
  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.

Visual Basic for Applications
  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

Aa436354.vs_note(en-us,office.12).gif  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
Visual Basic for Applications
  Shape.BorderArtFormat = Document.BorderArts(1)
is equivalent to
Visual Basic for Applications
  Shape.BorderArtFormat.Name = Document.BorderArts(1).Name
.
Visual Basic for Applications
  Shape.BorderArtFormat = Document.BorderArts(1)
Visual Basic for Applications
  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.

Visual Basic for Applications
  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

See Also