I need to find ALL ocurances of word "Name:" or "Adress: A" or ... in that
*.doc and then boldit complete row where is that word.
Problem is that with this code it only bold rows where it finds first
ocurances of word "Name:" or "Adress: A" or ...
I try everything and i can't find solution. Plese help if u can.
To start macro i call procedure Replace_Bold
I have next code:
Sub DoFindBold(FindText As String)
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = FindText
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
If Selection.Find.Found Then
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Font.Bold = wdToggle
Selection.Find.Execute
Else
Selection.Find.Execute
End If
End Sub
///// and another one
Sub Replace_Bold()
Call DoFindBold("Name:")
Call DoFindBold("Adress: A")
' ... line call continues ca. 150 times ...
End Sub
Helmut Weber - 09 Apr 2006 12:44 GMT
Hi Zeljko,
you don't need more than this in principle:
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "brown"
While .Execute
rDcm.Select
rDcm.Bookmarks("\Line").Range.Font.Bold = True
Wend
End With

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"