Macro for reformatting Word

Hello.
Is it possible to make a macro that will take 250-300 lines of text,
place a line break (Enter) between each line,
and then identify the line break as Heading 1, and the paragraph as Heading 2?
normanwillisAsked:
Who is Participating?
 
Rgonzo1971Connect With a Mentor Commented:
Hi,

pls try

Sub Macro()
'

    Selection.WholeStory
    Selection.Style = ActiveDocument.Styles("Heading 2")
    For Idx = ActiveDocument.Paragraphs.Count To 1 Step -1
        ActiveDocument.Paragraphs(Idx).Range.Select
        Selection.HomeKey Unit:=wdLine
        Selection.TypeParagraph
        Selection.MoveUp Unit:=wdLine, Count:=1
        Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
        Selection.Style = ActiveDocument.Styles("Heading 1")
    Next
    
End Sub

Open in new window

Regards
0
 
normanwillisAuthor Commented:
Nailed it first try.
0
 
normanwillisAuthor Commented:
On the full document (1500 pages) it hung up. But it was fun to watch it operate on the shorter document (13 pages). It ran from back to front.
0
All Courses

From novice to tech pro — start learning today.