Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

move current cursor line to top of window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dodge.nathan@gmail.com - 22 Sep 2007 16:23 GMT
One time awhile back I had found a macro for positioning the curent
cursor line to the top of the window.  After quite a bit of web
searching I can't seem to find it again.

Does anyone know how to accomplish this ?
Jay Freedman - 22 Sep 2007 18:00 GMT
>One time awhile back I had found a macro for positioning the curent
>cursor line to the top of the window.  After quite a bit of web
>searching I can't seem to find it again.
>
>Does anyone know how to accomplish this ?

Include this line in your macro:

  ActiveWindow.ScrollIntoView Selection.Range, True

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Jayawanth - 25 Sep 2007 06:28 GMT
Dear Jay Freeman,
I had posted this question earlier. There were no replies. You may be able
to help out.

While reading through a word document, after reading down a few lines I would
like to focus on the current section.  It is desirable to pull the current
line to the top of the window. Similarly make current section or paragraph
begin at the top of the window. Any simple macros to do this?

Thanks,
Jayawanth

> >One time awhile back I had found a macro for positioning the curent
> >cursor line to the top of the window.  After quite a bit of web
[quoted text clipped - 11 lines]
> Microsoft Word MVP        FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Jayawanth - 25 Sep 2007 07:22 GMT
I tried the macro posted - it works only if the cursor is off the visible
window. If the cursor is in the middle of the window, it will not scroll
current line to the top.

> Dear Jay Freeman,
> I had posted this question earlier. There were no replies. You may be able
[quoted text clipped - 23 lines]
> > Microsoft Word MVP        FAQ: http://word.mvps.org
> > Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Jay Freedman - 26 Sep 2007 02:07 GMT
If you can keep track of the number of lines added, you can use the
ActiveDocument.ActiveWindow.SmallScroll method to scroll the screen.
The trouble is that there's no usable way of finding out where the
Selection is with respect to the top of the window -- you can use the
Information method to get the vertical position relative to the top of
the page or the top margin, but not the visible window.

>I tried the macro posted - it works only if the cursor is off the visible
>window. If the cursor is in the middle of the window, it will not scroll
[quoted text clipped - 21 lines]
>> >
>> >    ActiveWindow.ScrollIntoView Selection.Range, True

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.