PDA

View Full Version : Solved: How to move current line to top off window



GoNDIrish
02-12-2008, 02:48 PM
I'm wondering if anyone knows how to accomplish this. Basically, what I'm doing is going to a bookmark in a Word 97 document. Once the bookmark is found and the cursor is placed on that line, I'd like the page to scroll so the line that the found bookmark is on will be the first line displayed in the window. I have a limited space in the window that I"m displaying the document in and I'd like to display as much as possible from the bookmark forward. It's easy to do a smallscroll in the activewindow, but I never know how much I need to scroll up each time. I've searched and searched, and it's been very frustrating trying to find the answer to this one. Thanks! By the way, I'm displaying the document in a WebBrowser window in a VB6 application.

gwkenny
02-13-2008, 02:28 AM
The cheap way is to go to the end of the document and then goto your bookmark.

Nelviticus
02-13-2008, 02:39 AM
If you put a bookmark at the end of the bit you want to show as well as a bookmark at the beginning, you can .Select the last bookmark and the view will jump to it, then .Select the first one and the view will jump back there but it'll be at the top of the page instead of the bottom.

It's easier to do than it is to explain:
With ActiveDocument
.Bookmarks("EndPoint").Select
.Bookmarks("StartPoint").Select
End With
If it doesn't quite work, try moving your endpoint further down.

Regards

GoNDIrish
02-14-2008, 09:57 AM
Replies are MUCH appreciated. Both suggestions work great....never thought of doing that. Thanks again, you've been a real help!