A
Angie M.
Hi,
I have the following macro that will underline the first sentence of any
text formatted with a Heading 1 style. I'm trying to rewrite the macro to
accommodate legal style numbering as in:
ARTICLE I
LEASES AND RENTS
In this example "article 1" is auto numbering coming from the style and then
there's a line break (Shift+Enter). I want the macro to underline the title
of the section, in this case 'LEASES AND RENTS".
Here's what I have (thanks to this newsgroup) that works for outline
numbering:
Sub BoldHeadingArt()
Dim myPara As Paragraph
Dim rngPara As Range
For Each myPara In ActiveDocument.Paragraphs
If myPara.Style = ActiveDocument.Styles(wdStyleHeading1) Then
Set rngPara = myPara.Range.Sentences(1)
With rngPara
.Font.Bold = True
End With
End If
Next myPara
End Sub
Should I assign the range to something other than a sentence (because there
will be no period involved), I've tried everything I know and cannot make
this work. Can you help? Thanks
I have the following macro that will underline the first sentence of any
text formatted with a Heading 1 style. I'm trying to rewrite the macro to
accommodate legal style numbering as in:
ARTICLE I
LEASES AND RENTS
In this example "article 1" is auto numbering coming from the style and then
there's a line break (Shift+Enter). I want the macro to underline the title
of the section, in this case 'LEASES AND RENTS".
Here's what I have (thanks to this newsgroup) that works for outline
numbering:
Sub BoldHeadingArt()
Dim myPara As Paragraph
Dim rngPara As Range
For Each myPara In ActiveDocument.Paragraphs
If myPara.Style = ActiveDocument.Styles(wdStyleHeading1) Then
Set rngPara = myPara.Range.Sentences(1)
With rngPara
.Font.Bold = True
End With
End If
Next myPara
End Sub
Should I assign the range to something other than a sentence (because there
will be no period involved), I've tried everything I know and cannot make
this work. Can you help? Thanks