Bold Text

A

Angie M.

Hi,

I have the following code:

ActiveDocument.Bookmarks("bkRec2").Range.Text = frmAddl.ComboBox2.Text
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Range.Text = frmAddl.txtRec2.Text

it works just great. Problem is, I have to BOLD the frmAddl.combobox2.text
and nothing else. I've tried all kinds of ways to to this but can't get it
to bold, or everything bolds.

Can you help?? Thanks
 
J

Jean-Guy Marcil

Angie M. said:
Hi,

I have the following code:

ActiveDocument.Bookmarks("bkRec2").Range.Text = frmAddl.ComboBox2.Text
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Range.Text = frmAddl.txtRec2.Text

it works just great. Problem is, I have to BOLD the frmAddl.combobox2.text
and nothing else. I've tried all kinds of ways to to this but can't get it
to bold, or everything bolds.

Try this:

Dim rgeInsertText As Range

Set rgeInsertText = ActiveDocument.Bookmarks("bkRec2").Range

With rgeInsertText
.Text = frmAddl.ComboBox2.Text
.Bold = True
.Collapse wdCollapseEnd
.InsertParagraphAfter
.Collapse wdCollapseEnd
.Text = frmAddl.txtRec2.Text
End With


Beware of the Selection objrct.

In your code it is not clear whether you want both text to appear one after
the other.

By using only the range object, it will always be so. In your code,
sometimes it may not, depending on the cursor location when the code is
launched.
 
A

Angie M.

Worked great, thanks for the expert help.

Jean-Guy Marcil said:
Try this:

Dim rgeInsertText As Range

Set rgeInsertText = ActiveDocument.Bookmarks("bkRec2").Range

With rgeInsertText
.Text = frmAddl.ComboBox2.Text
.Bold = True
.Collapse wdCollapseEnd
.InsertParagraphAfter
.Collapse wdCollapseEnd
.Text = frmAddl.txtRec2.Text
End With


Beware of the Selection objrct.

In your code it is not clear whether you want both text to appear one after
the other.

By using only the range object, it will always be so. In your code,
sometimes it may not, depending on the cursor location when the code is
launched.
 

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