How can I anchor the view during macro function

J

JeffG

I have a macro that goes to the top of my document, finds some fields and
changes some of them. When I do this, the macro leaves me at the last
change. What is the best way to restore the display view to exactly the way
the display was before the macro ran (minus those changes, of course) with
the cursor where it was before the macro ran?

Along with that, how do you hide the macro screen changes from the user
while the macro runs?

Thanks for any help.
 
T

Tony Jollans

Application.ScreenUpdating = False

.. is the statement you want.

As for restoring the display - better not to change it in the first place.
Do not use the Selection; do all your Find and Replace operations using a
Range object - ActiveDocument.Content perhaps.
 
G

Gordon Bentley-Mix

Oops! Sorry. Didn't see this thread or Tony's reply (which pretty much echos
my advice) before I posted an answer in the duplicate.

(Wish they'd get the problem with the newgroups sorted. This is getting
ridiculous!)
--
Cheers!

Gordon Bentley-Mix
Word MVP

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 

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