Bolding certain text

R

Ryan Curry

Hi all, I'm trying to create a small VB code that allows us to save decisions
in a singe document. I have 3 text boxes that we'll fill out (problem,
decision, and decider) and when you hit the command button it will insert the
information below any previous decisions that have been recorded.

The issue is that I would like to enter in "Problem Description: " &
strProblem but have Problem Description be entered as bold (for readability)
and for the LIFE of me I can't find where to set this. I've tried entering
it in as a lone paragraph and setting that range to bold and Word doesn't
like it. I wish I could just find the text and bold it but I can't figure
that part out.

I'm on Word 2003 and using the Visual Basic Editor for my code. Any help is
GREATLY appreciated.
 
H

Helmut Weber

Hi Ryan,

something along these lines:

Sub Macro8()
Dim s As String
s = "xxxxxxxxxx: "
With Selection
.Collapse
.Bookmarks.Add "bold"
End With
With ActiveDocument.Bookmarks("bold")
.Range.Text = s
.End = .End + Len(s)
.Range.InsertAfter "yyyy"
.Range.Font.Bold = True
.Delete
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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