How to save and return to position in document?

  • Thread starter Thread starter charles
  • Start date Start date
C

charles

Using Word 2000, I need to run a macro that selects parts of a
document, does some reformatting, and returns to the original
position.

I just can't think of how to save and return to the original position
in Word.

If anyone can help, I would appreciate it a lot.

Thanks.
 
Have your macro set a bookmark at the starting position and return to it at
the end?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Charles,

Something like this:

Sub Scratchmacro()
'Create a bookmark at current selection point:
ActiveDocument.Bookmarks.Add Name:="tmpMark", Range:=Selection.Range
MsgBox "Do your thing here"
'When finished, go to the bookmark
Selection.GoTo what:=wdGoToBookmark, Name:="tmpMark"
'Kill the bookmark
ActiveDocument.Bookmarks("tmpMark").Delete
End Sub
 
Using Word 2000, I need to run a macro that selects parts of a
document, does some reformatting, and returns to the original
position.

I just can't think of how to save and return to the original position
in Word.

If anyone can help, I would appreciate it a lot.

Thanks.

Thank you Susan and Greg. Using bookmarks works fine. (I never used
them before and thought I'd have to do some VB thing like in Excel.)

Great.
 

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

Back
Top