Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keep the active line centered (Word (Office) 97)

    Is there a way to keep Word's working line in the middle of the window, so that the text in the window rolls up or down as you go through a document? (This is different from Scroll Lock, which carries the highlight beyond the window.)
    Such a feature would be very helpful in editing (and, of course, even a first draft entails some editing) by showing subsequent text as well as preceding text. Perhaps it already exists in Word 97.
    I'd appreciate any leads to such instructions, module, macro or add-in, because I don't know how to write VBA code.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Keep the active line centered (Word (Office) 97)

    This sounds a lot like a recent request... searching memory banks... can't find it, sorry. I don't recall there being an easy solution.

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Keep the active line centered (Word (Office) 97)

    Sounds like it would be a useful feature to have as an optional mode; but just to second Jefferson's opinion, there's definitely no simple way to do this.

    You can use a line of code like this:

    ActiveDocument.ActiveWindow.VerticalPercentScrolle d = 50

    To scroll to the middle of the active window, but that's not quite the same thing as forcing the current line of text to the middle of the screen. For example, if you ran the above line of code in a document which contains only one or two lines of text, the view will scroll to the middle of the active window, causing the text to be scrolled up out of your view! The effect might also differ depending on what screen resolution you have set. It would probably require API methods to get the actual line of text to appear in the middle of the screen.

    Another difficulty would be figuring out a way to trigger the running of the code every time you move to another line.

    By the way, just in case you are not yet using a wheel mouse, the whole issue of scrolling gets a lot easier when you have one.

    Gary

  4. #4
    New Lounger
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Keep the active line centered (Word (Office) 97)

    Thanks jscher and Gary Frieder - I guess I should give up.
    But before I do, I'd like to try your suggestion
    " ActiveDocument.ActiveWindow.VerticalPercentScrolle d = 50 "
    - but where do I put it, and how?

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Keep the active line centered (Word (Office) 9

    I notice that they are not online now, so I'll try to help. You could open the VBE by pressing Alt+F11 & then open an immediate window (Ctrl+G). Paste the code (w/o quotes) in & press <enter>.

    However, as Jefferson alluded to, this is an unfinished solution. You would need a way to run the code automatically every time your cursor went to another line. Otherwise, switching to another window & pressing <enter> (or even manually running a macro every time your cursor went to another line) would be harder than manually scrolling.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Keep the active line centered (Word (Office) 97)

    Gary's keyword led me to the correct archive in my massive e-mailbox 'o archives:

    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>
    Subject: Keeping line being entered to center of screen (Word 2000) [#237257]
    Poster: Will Williams
    Posted on: 21-Mar-03 16:40

    Anyone know if you can/how you would set things up so that that the line of text you are typing up is always at the mid point up/down the blank part of the screen.

    <center>
    <img src=/w3timages/blackline.gif width=33% height=2></center>

    Subject: Re: Keeping line being entered to center of screen (Word 2000) [#237382]
    Poster: jscher2000
    Posted on: 22-Mar-03 01:24

    Word offers a method called ActiveWindow.ScrollIntoView(object, start) which lets you bring an off-screen insertion point to the top (start parameter True) or bottom (start parameter False) of the screen, typically to the top. This could be useful if you had used the scrollbar to view a different part of the document and now wanted to find your place again quickly. You also can use it to scroll to another kind of object (e.g., a picture) somewhere else in the document.

    In Word 2000, ScrollIntoView doesn't have a "middle of the screen" option. Therefore, I think the macro to do this would have to do a lot of math. (That is, you could use the ActiveWindow.SmallScroll(Down, Up) method, but figuring out the number of lines to move up or down would be a bit of work.)

    <center>
    <img src=/w3timages/blackline.gif width=33% height=2></center>

    Subject: Re: Keeping line being entered to center of screen (Word 2000) [#237497]
    Poster: Klaus Linke
    Posted on: 22-Mar-03 15:53

    .ScrollIntoView doesn't work as advertised for me (The "start" parameter = True/False doesn't seem to have a great -- or at least predictable -- influence, so it seems hopeless to get exact control).

    Something like this seems to work:

    Application.ScreenUpdating = False
    ActiveWindow.VerticalPercentScrolled = 0
    ActiveWindow.ScrollIntoView Selection.Range, True
    Application.ScreenUpdating = True

    Klaus

    <center>
    <img src=/w3timages/blackline.gif width=33% height=2></center>

    Subject: Re: Keeping line being entered to center of screen (Word 2000) [#237504]
    Poster: Will Williams
    Posted on: 22-Mar-03 16:57

    Thanks for the time you've given on this. I'm being dumb here. The command
    ActiveWindow.ScrollIntoView(object, start)
    is found where?

    I have created a macro using Klaus's suggested wording. It works in that Word does not point to any errors and require me to debug, but the macro I created doesn't do anything. Would you please explain about the ActiveWindow command, please? The help feature in Word or VBA doesn't mention it.

    <center>
    <img src=/w3timages/blackline.gif width=33% height=2></center>

    Subject: Re: Keeping line being entered to center of screen (Word 2000) [#237541]
    Poster: jscher2000
    Posted on: 23-Mar-03 00:46

    I'll explain how I got there and, because it's Saturday and I feel lazy, I'll point you to the online help screens you need.

    In the VB Editor, I pressed F2 and did a search for scroll. I then reviewed the list for all the different scrolling methods, highlighted the ones that sounded interesting, and pressed F1 to read the online help on them. If this doesn't give you any help, you might need to fire up the Office Installer again and install all the VBA help files.

    ActiveWindow is a not a command, it's a shorthand reference to the document window that has "the focus." That's usually the front-most Word window, but it could be behind something else, like the VB Editor window. When you type ActiveWindow and then press period, VB pops up a list of the properties and methods that you can use to operate on that window. This is a different set of properties and objects than you would get if you started with ActiveDocument. A Document object is a bunch of text, while a Window object is a kind of viewer... okay, I'll stop the academic digression, but here's the point: sometimes, you need to try the other one if the one you're exploring doesn't have any useful properties or methods.

    Now, my impression is that ScrollIntoView is useful to get the insertion point onto the visible part of the document window, but not to position it precisely. What's Klaus' code does is this: ActiveWindow.VerticalPercentScrolled = 0 scrolls to the top of the document without moving the insertion point, just as if you used the scrollbar; ActiveWindow.ScrollIntoView Selection.Range, True then displays the portion of the document which contains the insertion point. On my system (Word 2000 on Windows 2000, all settings the way I like them), in Normal View the insertion point line ends up about one third of the way down the window. In Print Layout mode, the page containing the insertion point is about at the top of the window because I happened to click about 2" down in the text on that page. Note that I clicked in a very long document. If you try this on a short document, you won't see anything happen because the scrollbar can't move very much.

    Does this help? If we can't create the effect you want, can you explain why you want it in case there is another/better solution?

    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

    Note: this doesn't actually do automated real-time positioning; it's hard to do that without monitoring every keystroke, potentially making the document bounce around like crazy.

  7. #7
    New Lounger
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Keep the active line centered... Thanks, all!

    It would be a nice feature, but learning how to do this would require more effort than just scrolling.
    Thanks for the suggestions, advice and warnings.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •