View Single Post
 
Old 03-24-2018, 12:54 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could, for example, use Find/Replace to insert an empty paragraph before every question. So, if your questions use the Heading 1 Style, simply do a Find/Replace for that with:
Find Style = Heading 1
Replace = ^p^&
It's a bit trickier to do the rest manually from there for +10,000 questions, but the following macro should take care of the lot:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  If .Characters.Last.Previous <> vbCr Then .InsertAfter vbCr
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = "^p^&"
    .Format = True
    .Style = wdStyleHeading1
    .Forward = True
    .MatchWildcards = False
    .Wrap = wdFindContinue
    .Execute Replace:=wdReplaceAll
  End With
  If .Characters.First = vbCr Then .Characters.First.Delete
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Format = False
    .Text = "[^13]{2,}"
    .Replacement.Text = ""
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Execute
  End With
  Do While .Find.Found
    .Paragraphs.Last.Range.Style = wdStyleNormal
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote