TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
I haven't been able to find a way to do this with a variable, but the simplest way to do this is with bookmarks.
'if bookmark exists, delete it, then add for current cursor position Sub BookmarkAddHere() If ActiveDocument.Bookmarks.Exists("CursorPosition") Then ActiveDocument.Bookmarks.Item("CursorPosition").Delete End If ActiveDocument.Bookmarks.Add "CursorPosition", Selection.Range End Sub
'go to bookmark for how many times you want Sub BookmarkGoTo() Selection.GoTo what:=wdGoToBookmark, Name:="CursorPosition" End Sub
|
The AddBookmarkHere snippet could be added to a Public Document_Close() procedure so it always remembers the last cursor position in every document.
Likewise, the BookmarkGoTo snippet could be added to a Public Document_Open() procedure so it always jumps to the last cursor position in every document.
|
|