|
|
|
|
|
|
Word
|
Return to Last Location
|
|
Ease of Use
|
Intermediate
|
Version tested with
|
2002
|
Submitted by:
|
fumei
|
Description:
|
On open of your document, you're automatically taken to the last location at which you worked.
|
Discussion:
|
On document close, this procedure creates a new bookmark at last location of the insertion point (cursor). On document open, it returns to that bookmark. It then deletes the bookmark, so when it closes again, the new last location is marked. This is handy if you are working on large documents and just want to come back to where you left off.
|
Code:
|
instructions for use
|
Private Sub Document_Close()
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.Bookmarks.Add Name:="StoppedHere", Range:=Selection.Range
End Sub
Private Sub Document_Open()
Selection.GoTo what:=wdGoToBookmark, Name:="StoppedHere"
ActiveDocument.Bookmarks("StoppedHere").Delete
End Sub
|
How to use:
|
- Copy the code above.
- Open your document in Word.
- Hit Alt+F11 to open the Visual Basic Editor (VBE) window.
- Double-click the project with your document's name.
- Click the plus sign beside Microsoft Word Objects.
- Right click ThisDocument and select View Code.
- Paste the code into the window that appears at right.
- Hit the little diskette button to save your code into the document and close the VBE window.
|
Test the code:
|
- Place selection point at whatever location you want to mark.
- Save and Close the document.
- Open the document.
|
Sample File:
|
StopStart.zip 4.67KB
|
Approved by mdmackillop
|
This entry has been viewed 138 times.
|
|