Formatting Text

D

Diamonds_Mine

I'm using the code below that will write names entered in a text box into the
document. The "To" field is using a 1" hanging indent (this is not set up in
a table). The "txtAuthor" field is set up for multi-line text. I would
like to know how using code to format the 2nd line and subsquent lines to
align with the 1" hanging indent so that the names align properly in the
document. Thank you for your assistance.

PopulateValues "Author", Frm_Education.txtAuthor
 
J

Jean-Guy Marcil

Diamonds_Mine was telling us:
Diamonds_Mine nous racontait que :
I'm using the code below that will write names entered in a text box
into the document. The "To" field is using a 1" hanging indent (this
is not set up in a table). The "txtAuthor" field is set up for
multi-line text. I would like to know how using code to format the
2nd line and subsquent lines to align with the 1" hanging indent so
that the names align properly in the document. Thank you for your
assistance.

PopulateValues "Author", Frm_Education.txtAuthor

To give you a specific answer we would need to know what the
"PopulateValues" function (or sub) actually does.

However, generally speaking, when inserting text in a document, make sure
that the inserted text is managed by a range object. Then, you can
manipulate the range as you want:

Dim rgeInsertText As Range

Set rgeInsertText = ActiveDocument.Bookmarks("Author").Range
With rgeInsertText
.InsertAfter "Text from Frm_Education.txtAuthor"
'Now your range consits of the text you just inserted, so you can
continue with:
.Style = "Some Style Name"
'or
.ParagraphFormat....
'Or, if you have more than one paragraph
.Paragraphs(2).Range.Font.Bold = True
'etc...
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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