Autoopen and goback

J

John Doue

Hi,

In my autoopen macro, I have the "Application.GoBack" statement. The
problem is, when in a first document, I open a second, autoopen brings
me back to the first instead of remaining in the second. How can I avoid
this and still benefit from goback ?

Thanks
 
J

Jezebel

The short answer is: don't mess around with the selection object in VBA. Use
Range objects; then the problem doesn't arise in the first place.
 
J

John Doue

Jezebel said:
The short answer is: don't mess around with the selection object in VBA. Use
Range objects; then the problem doesn't arise in the first place.
And the longer answer might be .... ?
Thanks
 
W

Word Heretic

G'day John Doue <[email protected]>,

The normal method is to trap the doc close, and set a bookmark to the
last edit point. Then, on autoopen, you call an application.ontime to
delay the execution of a second macro, that then selects the bookmark
if it exists.

The bookmark is a child of the activedocument, so it wont cause the
effect you describe.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


John Doue reckoned:
 
J

John Doue

Word said:
G'day John Doue <[email protected]>,

The normal method is to trap the doc close, and set a bookmark to the
last edit point. Then, on autoopen, you call an application.ontime to
delay the execution of a second macro, that then selects the bookmark
if it exists.

The bookmark is a child of the activedocument, so it wont cause the
effect you describe.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


John Doue reckoned:
Thanks Steve. Actually, I was running such a macro until I thought I had
missed the obvious and went back to "goback". I guess trying to outsmart
myself was a bad idea and I will restore my previous routine. Thanks for
making me see the light.
 

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