View Single Post
 
Old 07-24-2020, 03:14 AM
stormrider2230 stormrider2230 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jan 2016
Posts: 4
stormrider2230 is on a distinguished road
Default Macro to add paragraph borders

Hello,

I am new to VBA and struggling to combine code from different sources.
I have a sort of a report that is comprised of several lines of text, that can be considered as parapgraphs.

I need to add a box line, or single cell line arround each paragraph, takes much time if there are many.

I have managed to do something with this code, but this applies border around each line, instead of paragraph.


Dim rng As Range
Dim brd As Border

Set rng = ActiveDocument.Range
With rng.Find
.Text = "Paragraph_starting_word*^13"
.MatchWildcards = True
Do While .Execute
For Each brd In rng.Paragraphs.Borders
With brd
.LineStyle = wdLineStyleSingle
End With
Next brd

rng.Collapse wdCollapseEnd
rng.End = ActiveDocument.Range.End
Loop
End With

I would appreciate help.
Reply With Quote