View Single Post
 
Old 04-12-2025, 11:20 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

Hi, RobiNew! Please, try this one:
Code:
Sub BorderColor()

Dim oBrdr As Variant
Dim MyColor As Long
    
    Application.ScreenUpdating = False
    MyColor = InputBox("Specify color code", "Border Color")

    For Each oBrdr In Array(wdBorderLeft, wdBorderRight, wdBorderTop, wdBorderBottom)
        With Selection.ParagraphFormat.Borders(oBrdr)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth050pt
            .Color = MyColor
        End With
    Next oBrdr
    Application.ScreenUpdating = True
End Sub
It is shorter but not faster. Besides, you may face an issue entering a color code.
Reply With Quote