Discussion:
MS Access VBA - how to bold text?
(too old to reply)
Keith G Hicks
2008-01-11 17:42:51 UTC
Permalink
Word 2003
Access 2003

I'm creating the body of a document from a dot file. I need to bold a
sentence that comes between 2 others.


Set docWord = objWord.Documents.Add(Template:=sWordFormsPath & "LetRec.dot")

Dim rngWord As Word.Range

Set rngWord = docWord.Goto(What:=wdGoToBookmark, Name:="LetterBody")

rngWord.InsertAfter "We have enclosed a signed and notarized authorization
that allows us to receive this inforrmation on behalf of our client. "
Need to turn bold ON here to bold the following sentence
rngWord.InsertAfter "If you would prefer payment in advance, kindly advise
and we shall remit same immediately. "
Need to turn bold OFF here
rngWord.InsertAfter "Thank you for your anticipated cooperation."


I've tried a few things that don't seem to work. What code do I need to bold
that middle sentence?

Thanks,

Keith
Keith G Hicks
2008-01-11 22:09:22 UTC
Permalink
Here's the answer if anyone's interested:

with rngWord
.Collapse wdCollapseEnd
.InsertAfter "If you would prefer payment in advance, kindly..."
.Font.Bold = True
.Collapse wdCollapseEnd
.InsertAfter "Thank you for your anticipated cooperation."
.Font.Bold = False
end with
Post by Keith G Hicks
Word 2003
Access 2003
I'm creating the body of a document from a dot file. I need to bold a
sentence that comes between 2 others.
Set docWord = objWord.Documents.Add(Template:=sWordFormsPath &
"LetRec.dot")
Post by Keith G Hicks
Dim rngWord As Word.Range
Set rngWord = docWord.Goto(What:=wdGoToBookmark, Name:="LetterBody")
rngWord.InsertAfter "We have enclosed a signed and notarized authorization
that allows us to receive this inforrmation on behalf of our client. "
Need to turn bold ON here to bold the following sentence
rngWord.InsertAfter "If you would prefer payment in advance, kindly advise
and we shall remit same immediately. "
Need to turn bold OFF here
rngWord.InsertAfter "Thank you for your anticipated cooperation."
I've tried a few things that don't seem to work. What code do I need to bold
that middle sentence?
Thanks,
Keith
Continue reading on narkive:
Loading...