Solved

Macro for reformatting Word

Posted on 2014-12-10
3
192 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 49

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

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.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

809 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