Repositioning after running macro

A

Alan Stancliff

At work, (I prepare medical transcriptions), Word pops up a demographic
screen. With the kind help of some of the people here, I have managed to put
together a macro that goes into that demographic screen, which is in
continuous break section 1, copy some information, and assign it to
Autocorrect entries. We enter text into continuous break section 2 only. The
document opens in section 2, and the macro starts out by typing in these
characters: <>, jumping to section 1 to do its magic, returning to the <>
characters in section 2, and then deleting them. The object of the exercise
is to put the cursor back exactly where it had been before the macro ran.

A slight problem is that when it goes back to the marker in section 2, that
part is now at the top of the screen. In other words, the view port has
changed. Is there a way of having it return to the <> marker, erase it, and
have the viewpoint at the same section of the screen? For example, if the
cursor was at line 15 when it typed out the <> marker, before the rest of the
macro ran, at the end I would like it to return to the marker, delete it, and
then reposition that back to line 15.

I hope this is clear.

Regards,

Alan
 
H

Helmut Weber

Hi Alan,

IMHO, not in a straighforward way.
There are things like:
ActiveWindow.SmallScroll down:=10

However, here and know, online help doesn't know it.

The key is, *not to go* anywhere at all,
but to use a range object instead of moving the selection.

Yes, easier said then done.

You might also consider splitting the document's window,
that is having section 1 in one window and
section 2 in another window.

But again, easier said then done.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

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