Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Profil Kitana
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [WORD] Remember Cursor Position to Go To It Later [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 748
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.


pus acum 4 ani
   
Pagini: 1  

Mergi la