BorderArtFormat Object (Publisher)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

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

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 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
Show: