Re-open Word document to previous cursor location with identical page vertical position

Posted by Malcolm on Super User See other posts from Super User or by Malcolm
Published on 2012-03-29T22:09:00Z Indexed on 2012/04/02 5:34 UTC
Read the original article Hit count: 466

Filed under:
|
|

I would like to return to my previous point of edit with the page vertically positioned identical to its original vertical position. The Shift+F5 technique returns me to the previous point of edit, but the page I return to is vertically positioned on the screen in a somewhat random manner. In other words, if my cursor is 300 vertical pixels from the top of the document viewport, I would like to re-open my page so that the location of the cursor is still 300 vertical pixels from the top of my viewport.

The following can be used to determine the vertical position (on the screen) of my text cursor:

ActiveWindow.GetPoint pLeft, pTop, pWidth, pHeight, Selection.Range

So the challenge becomes how to scroll my document in such a manner as to return my text cursor to its original vertical position (pHeight)?

There is no corresponding ActiveWindow.SetPoint and ActiveWindow.ScrollIntoView scrolls a selection range into view, but offers no control over the vertical position of the selection range on the screen.

© Super User or respective owner

Related posts about microsoft-word

Related posts about save