> I'm having trouble selecting a particular word and then applying the
> bold format to it. Does anyone have some example code to get me
[quoted text clipped - 3 lines]
>
> dy29832
Is the "particular word" already in the document, or is it being inserted by
your code? If it already exists, and it's in more than one place, do you
want to apply bold to all occurrences or just one (and if just one, how
should the macro recognize which is the "right" one)?
The techniques are different, depending on the answers to these questions.

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
dy29832 - 27 May 2008 18:28 GMT
Thanks for the response,
The word I am selecting is already in the document, but does not have the
bold format applied to it yet.
The word I would like to bold could possibly show up in the text later, but
I only want to bold this particular word because it is a heading.
I'm not sure if a macro can be written to recognize a heading versus text in
the body of a paragraph, but that would be a nice extra. Otherwise, I could
simply review my document and "unbold" the instances that were performed
incorrectly.
Thanks again,
David Yale
> > I'm having trouble selecting a particular word and then applying the
> > bold format to it. Does anyone have some example code to get me
[quoted text clipped - 10 lines]
>
> The techniques are different, depending on the answers to these questions.
Jean-Guy Marcil - 27 May 2008 19:40 GMT
> Thanks for the response,
>
[quoted text clipped - 8 lines]
> simply review my document and "unbold" the instances that were performed
> incorrectly.
So, you want to bold all instances of a particular word that appears in
heading pargraphs?
Are those headings formatted with a style?
Have you tried recording a macro?
See
http://word.mvps.org/faqs/macrosvba/UsingRecorder.htm
and
http://word.mvps.org/faqs/macrosvba/ModifyRecordedMacro.htm
dy29832 - 28 May 2008 00:34 GMT
The headings are the same style as all the other text in the paragraph.
I have tried recording a macro and I don't see where the bold statement is
located.
Here is the sub routine.
Sub Soapnote()
'
' Soapnote Macro
' Macro recorded 5/27/2008 by David Yale
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "REVIEW OF SYSTEMS"
.Replacement.Text = "REVIEW OF SYSTEMS"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.CorrectHangulEndings = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
End Sub
I use a Ctrl-H command to find and replace the text, then select format and
the bold selection. It does bold REVIEW OF SYSTEMS, but I can't figure out
how it does it in the routine.
Thanks,
David Yale
> > Thanks for the response,
> >
[quoted text clipped - 18 lines]
> and
> http://word.mvps.org/faqs/macrosvba/ModifyRecordedMacro.htm
Doug Robbins - Word MVP - 28 May 2008 04:06 GMT
Use:
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(Findtext:="REVIEW OF SYSTEMS", Forward:=True,
_
MatchCase:=True, MatchWildcards:=False, Wrap:=wdFindStop) =
True
Selection.Range.Font.Bold = True
Loop
End With

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> The headings are the same style as all the other text in the paragraph.
> I have tried recording a macro and I don't see where the bold statement is
[quoted text clipped - 76 lines]
>> and
>> http://word.mvps.org/faqs/macrosvba/ModifyRecordedMacro.htm