Problems with a right tab stop immediatly followed by a left tab stop.

E

Ebbe

Hey!

I need to write some right justified text immediately followed by some left
justified text (not confused with some centered text).
Am I right when I say, that it isn't possible to place two tab stops nearer
each other than 2 points?

If I run the following piece of code with x = 1, the 2nd tab stop is
overwriting the 1st tab stop.
But if x = 2 the code produces 2 tab stops.

How can I place the 2 tab stops as near as possible?

Ebbe
---------------------------------------------------------------------------------
Sub TabTest()
Dim TabPosition As Long
Dim x As Long

TabPosition = 200
x = 1

Selection.ParagraphFormat.TabStops.ClearAll

Selection.ParagraphFormat.TabStops.Add _
Position:=TabPosition, _
Alignment:=wdAlignTabRight, _
Leader:=wdTabLeaderSpaces

Selection.TypeText Text:=vbTab
Selection.TypeText "Right jystified text"

TabPosition = TabPosition + x

Selection.ParagraphFormat.TabStops.Add _
Position:=TabPosition, _
Alignment:=wdAlignTabLeft, _
Leader:=wdTabLeaderSpaces

Selection.TypeText Text:=vbTab
Selection.TypeText "Left jystified text"

Selection.TypeParagraph

End Sub

---------------------------------------------------------------------------------
 
K

Klaus Linke

Hi Ebbe,
Am I right when I say, that it isn't possible to place two tab
stops nearer each other than 2 points?

Looks like it. Probably, it would get confusing if tab stops could sit right on
top of one another.

Perhaps you might use a table instead (right-align in one cell, left-align in
the next, and set the table margins to zero)?

Regards,
Klaus
 
E

Ebbe

Hey Klaus.

It could be a possible solution, if it was not for the reason, that I cannot
use it in my case.
The tab stops can be different from line to line.
I would have to create an awful lot of tables.
I receive commands from a source with information about position, alignment
and contents, and from that I produce a document.

Ebbe
 
K

Klaus Linke

It could be a possible solution, if it was not for the reason, that I
cannot use it in my case.


I'm afraid you'll have to put up with the 2pt space then.
At least I'm out of ideas...

Klaus
 
E

Ebbe

Hey Klaus.

I have already done that.
My hope was, that some knew a better way to solve the problem.

But thank you fore trying ;-)

Ebbe
 

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