BorderArtFormat object (Publisher)
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.
Use the BorderArt property of a shape to return a BorderArtFormat object.
Use the Set method to specify which type of BorderArt you want applied to a picture.
You can also use the Name property to specify which type of BorderArt you want applied to a picture.
Note
Because Name is the default property of both the BorderArt and BorderArtFormat objects, you don't 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.
Example
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
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
The following example sets all the BorderArt in a document to the same type by 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
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
Methods
Properties
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for