Solved

Macro for reformatting Word

Posted on 2014-12-10
3
184 Views
Last Modified: 2014-12-10
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?
0
Comment
Question by:normanwillis
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:normanwillis
Comment Utility
Nailed it first try.
0
 

Author Comment

by:normanwillis
Comment Utility
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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now