Remember And Return To Last Edited Line In Word Document

Advertisement

By creating a simple macro it is now easier to find out the last edited line in Microsoft Word. Now you can be start from the exact same line where you stopped writing, after reopening a closed document. Microsoft Word 2010 enables users to write macros to integrate their own functions to be applied over the document.

To get started with writing such a function, launch Microsoft Word 2010 and open a document.

macro enabled docu

Now navigate to Developer tab. (In case you don’t find Developer tab, go to File menu, click Options, and in left pane click Customize Ribbon, from right pane enable Developer check-box. Click OK to to see Developer tab on the ribbon).

developer tab a

Now click Visual Basic.

visual basic 1

Visual Basic window will open, in the left pane, click on ThisDocument, Visual Basic editor will appear. Now copy these lines of code and paste in the VB editor.

Sub AutoOpen()

‘ GoToMyBookmarkText


On Error Resume Next

Selection.Find.ClearFormatting
With Selection.Find
.Text = “**************”
.Replacement.Text = “”
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
ActiveWindow.SmallScroll Up:=15

End Sub
Sub AutoClose()

‘ CreateMyBookmark


Selection.TypeText Text:=”**************”

End Sub

enter code 1

Once pasted, exit from VB editor. and save the document as Macro Enabled document(go to File menu and hit Save As).

save as

From Save as type options, click Word Macro-Enabled Document (*.docm), and click Save.

save as 21

Now close the Word document. Upon opening the same document you will be automatically taken to the last line edited and an asterisk(*) will be shown (which actually shows that you were editing this line earlier).

macro is enabled. 1

[via TheFreeWindows]

Advertisement
  • Pingback: Prepare Word 2010 Document For Distribution [Prepare Menu]()

  • ChristianProgrammer

    I can’t believe you made me do work in VB to make this current .. but I needed it. Multiple times day so I fixed it for anyone else who used to have a handy LITTLE macro to do this: NOTE My mod doesn’t clear the asterisks added automatically but I’m not about to spend any more of my times researching VB ‘A’ …sorry:

    Sub AutoOpen()

    ‘ GoToMyBookmarkText — not a method name but a Comment Go Figure !!?!?

    On Error Resume Next

    Selection.Find.ClearFormatting

    With Selection.Find

    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute FindText:=”**************”
    .Replacement.Text = “”

    End With
    Selection.Find.Execute
    ActiveWindow.SmallScroll Up:=15

    End Sub

    Sub AutoClose()
    ‘CreateMyBookmark same as above I was looking for a magic method but this is a comment
    Selection.TypeText Text:=”**************”
    End Sub

  • ChristianProgrammer

    .Execute FindText:=”**************” yea thats the change

  • KFL

    Well, very nice, but using Shift+F5 should go to last edited line, also when opening saved document