End of Story Issue

R

Rich M

I have user managed template driven by VBA macos. A recent problem occurred
in Word 2007 under Vista and I have not been able to reproduce with Word 2007
under XP. A macro issues a Selection.End Unit:=wdStory command and then
immediately follows with a Selection.MoveUp unit:=wdLine, count:=3 command.
If the users document view is set below 100% and they have a screen
resolution that allows multiple pages to be displayed when these commands
execute and there is an odd number of pages in the document being displayed
and the last line of the document happens to be the 1st line of the last page
.... then the MoveUp command actually places the cursor in the document 2
pages back. In other words, on a 5 page document with the last line being
the 1st line on page 5, then the cursor moves UP to page 3, and not page 4,
when the MoveUp command executes.

It appears that in this given situation the Selection.MoveUp command is
addressing screen coordinates and not document position.

Is this by design or error?
 
R

Rich M

Adding an update to my note. I just reproduced this in a Word 2003, XP
environment so I guess this is something that occurs by design at least in
these 2 environments of Word 2003 and 2007. In 10 years I've never
encountered this with my application and I guess it's just now more possible
because of larger monitors and higher resolutions such that a document saved
at a 75% view size is more likely to open with 2 pages displayed at once.
The implications of this is when programatically walking the cursor up the
document a line at a time unexpected results can occur.

Remedy, set document view to 100% prior to issuing a moveup command.
 

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