F
Fuzzhead
I have the following macro that I use after I have converted WordPerfect
documents to Word documents. It goes through and corrects the Headings. Many
of these Headings have more than one paragraph, so my question is there a way
to tie the formatting of the second and third paragraphs to that of the
Heading paragraph?
Set SearchRange = ActiveDocument.Range
SearchRange.TextRetrievalMode.IncludeFieldCodes = True
With SearchRange.Find
.Wrap = wdFindStop
.Format = True
.Text = "^dLISTNUM"
While .Execute
'Select Found Text
SearchRange.Select
'Avoid Style Collection Error If Number is 0
If SearchRange.Characters.Last.Previous.Text = "0" Then
SearchRange.Characters.Last.Previous.Text = "1"
End If
'Apply Heading Format To Whole Paragraph Using Found Text Number
Selection.Paragraphs(1).Style = ActiveDocument.Styles("Heading " _
& SearchRange.Characters.Last.Previous)
'Delete Found Text
SearchRange.Text = ""
'Reset Range For Next Search Area
SearchRange.SetRange Start:=SearchRange.End, _
End:=ActiveDocument.Range.End
Wend
End With
documents to Word documents. It goes through and corrects the Headings. Many
of these Headings have more than one paragraph, so my question is there a way
to tie the formatting of the second and third paragraphs to that of the
Heading paragraph?
Set SearchRange = ActiveDocument.Range
SearchRange.TextRetrievalMode.IncludeFieldCodes = True
With SearchRange.Find
.Wrap = wdFindStop
.Format = True
.Text = "^dLISTNUM"
While .Execute
'Select Found Text
SearchRange.Select
'Avoid Style Collection Error If Number is 0
If SearchRange.Characters.Last.Previous.Text = "0" Then
SearchRange.Characters.Last.Previous.Text = "1"
End If
'Apply Heading Format To Whole Paragraph Using Found Text Number
Selection.Paragraphs(1).Style = ActiveDocument.Styles("Heading " _
& SearchRange.Characters.Last.Previous)
'Delete Found Text
SearchRange.Text = ""
'Reset Range For Next Search Area
SearchRange.SetRange Start:=SearchRange.End, _
End:=ActiveDocument.Range.End
Wend
End With