Thread: [Solved] Making Line Bold
View Single Post
 
Old 05-29-2012, 06:38 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

Hi Janith,

You can do this with a wildcard Find/Replace, where:
Find = [!^13]@String*[^13]
Replace = ^&
and 'String' is the string to match with.

Here's a macro that does the same thing:
Code:
Sub MakeBold()
Application.ScreenUpdating = False
Dim StrFnd As String
StrFnd = InputBox("Please input the text for the lines to make bold", "Make Lines Bold")
If Trim(StrFnd) = "" Then Exit Sub
With ActiveDocument.Range.Find
  .ClearFormatting
  .Text = "[!^13]@" & StrFnd & "*[^13]"
  .Replacement.ClearFormatting
  .Replacement.Font.Bold = True
  .Replacement.Text = "^&"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = True
  .MatchWildcards = True
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote