Marking a location for return

Once upon a time I had a macro that would mark a spot within an MSWord document, with a second macro that would return the cursor to that marked spot. I would like to recreate these two simple macros.

Any ideas as to how to go about doing this

Thanks in advance.




Answer this question

Marking a location for return

  • Symtex

    Hi,

    No idea if this is what you had before but using the macro recorder I generated these 2 routines.

    Sub MarkSpot()
    '
    ' MarkSpot Macro
    ' Macro recorded 31/01/2007 by Andy Pope
    '
    With ActiveDocument.Bookmarks
    .Add Range:=Selection.Range, Name:="MySpot"
    .DefaultSorting = wdSortByName
    .ShowHidden = False
    End With
    End Sub
    Sub ReturnSpot()
    '
    ' ReturnSpot Macro
    ' Macro recorded 31/01/2007 by Andy Pope
    '
    On Error GoTo ErrReturnSpot

    Selection.GoTo What:=wdGoToBookmark, Name:="MySpot"
    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchByte = False
    .CorrectHangulEndings = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    ErrReturnSpot:
    Exit Sub
    End Sub



  • Marking a location for return