Thread: [Solved] Need help in MS Word 2013
View Single Post
 
Old 03-30-2014, 06:52 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit 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

In Bible texts, verse numbers are usually superscripted. Sometimes, when not superscripted, they have [] around them. The following macro will superscript all such numbers and delete the [] if present.
Code:
Sub Verses()
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  With .Replacement.Font
    .Bold = True
    .Superscript = True
  End With
  .Forward = True
  .Wrap = wdFindStop
  .Format = True
  .MatchWildcards = True
  .Text = "\[([0-9]{1,3})\]"
  .Replacement.Text = "\1"
  .Execute Replace:=wdReplaceAll
  .Text = "([0-9]{1,3})"
  .Execute Replace:=wdReplaceAll
End With
End Sub
Of course, if you have chapter & book numbers as well, you might not want those superscripted. Without knowing more about your document structure, though, I can't offer more than to suggest changing 'ActiveDocument' in the code to 'Selection' and selecting each range you want to process.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote