inserting bold text after bookmark

T

Tony

How I shold modify the following line of the code:

ActiveDocument.Bookmarks("Name").Range.InsertBefore "Text"

So that the "Text" will be inserted in bold ???

Thanks for advice.

Tony
 
D

Doug Robbins

ActiveDocument.Bookmarks("Name").Range.Font.Bold = True

--
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
 
T

Tony

It did not work, but with small modification I have it working. The code
looks like:

ActiveDocument.Bookmarks("CompanyName").Range.InsertBefore
(.Range("D" & x).Text)
ActiveDocument.Bookmarks("CompanyName").Select
Selection.Font.Bold = wdToggle

Thanks for help.

Tony
 
D

Doug Robbins

It certainly works for me.

--
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
 
A

Al Borges

One thing that you may be interested in is the situation whereby you need to
make numerous items BOLD. You have to reset things. Here's a sample code:

With .ActiveDocument.Content.Find
.ClearFormatting
.Text = "PAST MEDICAL HISTORY:"
.Forward = True
'.Replacement.Text = "PAST MEDICAL HISTORY:"
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
Call Resetsearch
With .ActiveDocument.Content.Find
.Text = "FAMILY HISTORY:"
.Forward = True
'.Replacement.Text = "FAMILY HISTORY:"
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
Call Resetsearch
With .ActiveDocument.Content.Find
.Text = "SOCIAL HISTORY:"
.Forward = True
'.Replacement.Text = "SOCIAL HISTORY:"
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
Call Resetsearch
etc etc
End Sub

Sub Resetsearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub

Regards,
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top