Formatting a Line

P

Peter Newman

Im creating a word doc on the fly from a VB6 application.

Ive managed to create a blank word Doc and insert a Header and footer without a problem. Ive also managed to insert a lines of text. The problem is that a single line has two aprts to it, a Discripter ( on ht eleft) and a monetry value to appear on the right of the page. How can i do this and right align the Monarty value

the code im using is

Dim oWord as Word Applicatio
Dim oDoc as word.Documen
Dim oparagraph as word.paragrap
Dim oRng as Word.Rang
Set oWord = CreateObject("word.Application"
Set oDoc = oWord.Document.Ad

With oDo
Set oParagraph = oDoc.Content.Paragraphs.Ad
Set oRng = Odoc.Bookmarks("\EndOfDoc").Rang
oRng.insertAfter "Line 1" & vbtab & "10.00" & vbcrl
oRng.insertAfter "Line 2" & vbtab & "1.00

orng.Collapse wdCollapseEn
End Wit
Set oDoc = Nothin
oword.Qui

I end up with the followin

Line 1 10.0
Line 2 1.0

But wan

Line 1 10.0
Line 2 1.0

Any suggestions
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UGV0ZXIgTmV3bWFu?=,
The problem is that a single line has two aprts to it, a Discripter ( on ht eleft) and
a monetry value to appear on the right of the page. How can i do this and right align
the Monarty valuesWell, the "easiest" would be to use a two-column table, with the second column formatted
right-aligned. If there are going to be a lot of entries, then concatenate them into a
delimited string, drop that into the range, then use ConvertToTable on the range.

The other possibility would be to set a right-aligned tab stop and put a TAB character
between the two parts.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 

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