Paragraph alignment does not work

C

Cloe

Hi all.
I use VB6 to create a Word document from an existing "template" I made.

This is a piece of the code:

Set wField = WordDoc.Fields(WordDoc.Variables("strReportHeader1").Index)
Set wRange = wField.Code
wRange.ParagraphFormat.Alignment = IIf(RTL, wdAlignParagraphRight,
wdAlignParagraphLeft)

The code does not align the text to the right (IIF returns 2,which is
wdAlignParagraphRight)

:((((((((
Please advise
Guy
 
J

Jezebel

First, selecting a field by relying on the index of your particular
docvariable seems obtuse, to say the least. The index numbers of your
DocVariables is just an artefact of the order in which you create them,
added to any that happen to be in your document already. Are you sure that
you're aligning the right paragraph, and how would you know? (And out of
curiosity, why such a bizarre approach?) -- Or do you in fact intend the
VALUE of the variable, rather than its Index?

Second, you're applying the alignment to the field code, when you should be
applying to the paragraph that contains that code.

Third, what is RTL ?
 
C

Cloe

Hi J,
RTL=RightToLeft.
I fixed the problem by using the values rather than the constants. I had
this problem before and I just forgot about it.
Thank you!
G
 

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