Solved

Macro for reformatting Word

Posted on 2014-12-10
3
198 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 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40491977
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
ID: 40492230
Nailed it first try.
0
 

Author Comment

by:normanwillis
ID: 40492355
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you how to use shortcut menus in the Access run-time environment.
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article ha…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

740 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