I have a paragraph like this:
Nov 19, 2014 - You are running the search on the Selection, but you're not changing that selection between runs. So you just end up making the same text bold over and over again. Here's a way to do what you're doing without the Selection object: Sub ParaStyle() Dim objPara As Paragraph For Each objPara In ... Word VBA Paragraph formatting-VBForums
And I am trying to change the style of the entire paragraph to a local style. I am using the following code:
Dim rgePages As Range
Dim p As Paragraph
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=3
Set rgePages = Selection.Range
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=6
rgePages.End = Selection.Bookmarks("\Page").Range.End
rgePages.Select
For Each p In rgePages.Paragraphs
If p.Style <> "Heading 1" Then
p.Style = "Body Text"
'p.Style = Word.WdBuiltinStyle.wdStyleBodyText
rgePages.Collapse Word.WdCollapseDirection.wdCollapseEnd
End If
Next
It is working fine till the time any line or a few words are in different style. Say for example if the line
So you just end up making
in the paragraph is in different style, it is marking the whole paragraph as "Body Text" except for that part. Is there a solution to this?