Auto-scroll in the Word window

N

Nomey

Hi all,

Does anyone here know whether it is possible have the Word window auto-scroll (by vba)? I'm asking this is because I woule like to keep looking at the same position all the time while typing, so there are always, let's say 10 (or any other number to be set) lines above the cursor automatically.

Cheers,
Shirley Nomey
 
J

Jonathan West

Nomey said:
Hi all,

Does anyone here know whether it is possible have the Word window
auto-scroll (by vba)? I'm asking this is because I woule like to keep
looking at the same position all the time while typing, so there are
always, let's say 10 (or any other number to be set) lines above the
cursor automatically.

Cheers,
Shirley Nomey

That's really hard to do. Firstly, you would need the macro to run on every
possible keypress. That alone makes it almost impracticable. You would have
to fire the macro from almost every keyboard combination that wasn't already
in used. (I do know of another way, but it is really complicated and
involves external programs which monitor the keystokes in the word editing
window and act accordingly. Don't go there.)

Second is that the scrolling controls in Word VBA aren't fine enough for the
job. The key property is the VerticalPercentScrolled property. But as you
can see from the Help, it is a value of type Long, in the range 0 to 100.
You can't assign fractional values. On a long document, that's not nearly
fine enough control for what you want to achieve.

So, I have to say that it can't be done.
 
K

Karl E. Peterson

Jonathan West wrote on 1/8/2010 :
That's really hard to do. Firstly, you would need the macro to run on every
possible keypress. That alone makes it almost impracticable. You would have
to fire the macro from almost every keyboard combination that wasn't already
in used. (I do know of another way, but it is really complicated and involves
external programs which monitor the keystokes in the word editing window and
act accordingly. Don't go there.)

Second is that the scrolling controls in Word VBA aren't fine enough for the
job. The key property is the VerticalPercentScrolled property. But as you can
see from the Help, it is a value of type Long, in the range 0 to 100. You
can't assign fractional values. On a long document, that's not nearly fine
enough control for what you want to achieve.

So, I have to say that it can't be done.

I'd tend towards the same conclusion, but would probably use "really
shouldn't" rather than "can't." The problem with monitoring keystrokes
is bad enough to warrant the shouldn't. A timer would be a complete
disaster, too. Can you even imagine, if you were trying to mouse
about, and the thing started scrolling on its own?

But for the actual repositioning, were one bull-headed enough to pursue
this, it *might* be possible to tweak the scrollbar properties at a
finer resolution than the object model allows?
 
N

Nomey

Jonathan & Karl, thanks for your savvy comments! My knowledge of vba is far too basic to even atttempt building such a routine. I thought it to be fairly straightforward, but apparently it isn't.

Kind regards,
Shirley
 

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