Hi NG!

Im trying to automate Word from Access and it works Ok, except for this
line:

wdApp.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight

Apparently Access VBA will not recognize wdAlignParagraphRight as a word
constant, and think of it as a Variable.
I have set a reference to the Word 10.0 Object library.

If I declare it as a Variable in Access, it expects it to have a value. Do
you know how i can do this?

All I really want to do is to right aling one paragraph, then reset to left
alignment.

Regards
Jan

Re: Constant problem by Helmut

Helmut
Tue Dec 09 06:28:44 CST 2003

Hi Jan,
you may use 2 (integer) instead.

Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0


Re: Constant problem by Jan

Jan
Tue Dec 09 06:34:27 CST 2003

Thanks, its working now.

Jan

"Helmut Weber" <elmkqznfwvccbf@mailinator.com> skrev i en meddelelse
news:0c6901c3be4f$fc9a99b0$a401280a@phx.gbl...
> Hi Jan,
> you may use 2 (integer) inste



Re: Constant problem by Can

Can
Tue Dec 09 09:07:19 CST 2003

"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
news:0c6901c3be4f$fc9a99b0$a401280a@phx.gbl...
> Hi Jan,
> you may use 2 (integer) instead.
>
> Greetings from Bavaria, Germany
> Helmut Weber
> "red.sys" & chr$(64) & "t-online.de"
> Word 97, NT 4.0
>

That's great, but the point of constants is that when Microsoft changes the
values, things will still work. This one may be relatively safe, but...
Are there any more general ways to solve the problem?



Re: Constant problem by Helmut

Helmut
Tue Dec 09 09:41:30 CST 2003

Hi,
if you use early binding, that is to set a reference
to the appropriate library, it should be possible
to use constants. I didn't understand, why this didn't
work from access, as Jan described it, so I recommended
this workaround. Maybe somebody else knows how big the
danger is of microsoft changing values of constants.
I regard it as a rather theoretical issue.

Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT4.0


Re: Constant problem by Jezebel

Jezebel
Tue Dec 09 20:40:12 CST 2003

You can refer to the constant as a property of the object that defines it.
If your project knows what 'Word' is (ie, you have a project reference to
MSWordX.olb) you can use

wdApp.Selection.ParagraphFormat.Alignment =
Word.wdParagraphAlignment.wdAlignParagraphRight



"Can Altinbay" <caltinbaytry123@earthlink.net> wrote in message
news:HylBb.5174$_r6.4348@newsread1.news.pas.earthlink.net...
> "Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
> news:0c6901c3be4f$fc9a99b0$a401280a@phx.gbl...
> > Hi Jan,
> > you may use 2 (integer) instead.
> >
> > Greetings from Bavaria, Germany
> > Helmut Weber
> > "red.sys" & chr$(64) & "t-online.de"
> > Word 97, NT 4.0
> >
>
> That's great, but the point of constants is that when Microsoft changes
the
> values, things will still work. This one may be relatively safe, but...
> Are there any more general ways to solve the problem?
>
>



Constant problem by anonymous

anonymous
Wed Dec 10 17:13:21 CST 2003

Try this:
Word.wdAlignParagraphRight

>-----Original Message-----
>Hi NG!
>
>Im trying to automate Word from Access and it works Ok,
except for this
>line:
>
>wdApp.Selection.ParagraphFormat.Alignment =
wdAlignParagraphRight
>
>Apparently Access VBA will not recognize
wdAlignParagraphRight as a word
>constant, and think of it as a Variable.
>I have set a reference to the Word 10.0 Object library.
>
>If I declare it as a Variable in Access, it expects it
to have a value. Do
>you know how i can do this?
>
>All I really want to do is to right aling one paragraph,
then reset to left
>alignment.
>
>Regards
>Jan
>
>
>
>.
>

Constant problem by Billy

Billy
Wed Dec 10 17:14:04 CST 2003

Try this:
Word.wdAlignParagraphRight

The wdAlignParagraphRight is part of Word, so Access
doesn't know about it.

>-----Original Message-----
>Hi NG!
>
>Im trying to automate Word from Access and it works Ok,
except for this
>line:
>
>wdApp.Selection.ParagraphFormat.Alignment =
wdAlignParagraphRight
>
>Apparently Access VBA will not recognize
wdAlignParagraphRight as a word
>constant, and think of it as a Variable.
>I have set a reference to the Word 10.0 Object library.
>
>If I declare it as a Variable in Access, it expects it
to have a value. Do
>you know how i can do this?
>
>All I really want to do is to right aling one paragraph,
then reset to left
>alignment.
>
>Regards
>Jan
>
>
>
>.
>