Thread: [Solved] Macro for text formatting
View Single Post
 
Old 08-07-2012, 04:07 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi George,

Try the following macro:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  .InsertBefore vbCr
  .AutoFormat
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^13[!^13\-]{1,}"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    With .Duplicate
      .Start = .Start + 1
      .Font.Bold = True
    End With
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
ActiveDocument.Paragraphs.First.Range.Delete
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 08-08-2012 at 04:48 PM. Reason: Code fix
Reply With Quote