Word 2007: wdVerticalPositionRelativeToPage on 2. page / Bug???

P

Paul Hofmann

Hello,
do you know the following phenomenon admits in Word 2007, and maybe do you
have an idea, how one could go around that, or is it maybe a Word 2007 bug.
The following code:

Set objWordDoc = Application.Documents.Add
Application.Visible = false
objWordDoc.Range(objWordDoc.Range.End - 1, objWordDoc.Range.End).InsertBreak
(wdPageBreak)

Set r = objWordDoc.Range(objWordDoc.Range.End - 1, objWordDoc.Range.End)

MsgBox r.Information(wdVerticalPositionRelativeToPage)

r.Font.Size = 19
objWordDoc.Content.InsertAfter (Chr(13))
Call objWordDoc.Paragraphs.last.TabStops.ClearAll

Set r = objWordDoc.Range(objWordDoc.Range.End - 1, objWordDoc.Range.End)

MsgBox r.Information(wdVerticalPositionRelativeToPage)

on the 1. page, the rows: MsgBox
r.Information(wdVerticalPositionRelativeToPage) displays different values,
but on the 2. and followed pages, the value is always the same.
Then i try this code:

Set r = objWordDoc.Range(objWordDoc.Range.End - 1, objWordDoc.Range.End)
r.Select
MsgBox Selection.Information(wdVerticalPositionRelativeToPage)

r.Font.Size = ifSize
objWordDoc.Content.InsertAfter (Chr(13))
Call objWordDoc.Paragraphs.last.TabStops.ClearAll

Set r = objWordDoc.Range(objWordDoc.Range.End - 1, objWordDoc.Range.End)

r.Select
MsgBox Selection.Information(wdVerticalPositionRelativeToPage)

Then it's ok, but when set Application.Visible on False then i have again
same values.

Has someone an idea, what is wrong, or is it an option in Word?

Thanks for help
Paul
 

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