Friday, September 30, 2016

MS Word Series: Bold Caption Label & Number But Not The Caption Text

This macro is intended to BOLD the CAPTION LABEL & NUMBER but not the caption title.

Sub CaptionBoldNot()
'
' CaptionBoldNot Macro
'
'
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Text = ""
    .Style = "Caption"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    With .Paragraphs.Last.Range.Duplicate
      .End = .Start + Len(Split(.Text, " ")(0)) + 1
      .MoveEndUntil " ", wdForward
      .Style = "Strong"
    End With
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub


Thanks to the original author

No comments: