none
range.moveend is not working RRS feed

  • Question

  • When I call it the Range.End does not change. It appears that End is readonly.  I have also tried bookmark.End ++.

    So I tried duplicating the range and calling MoveEnd()  That works on the duplicate, but then the bookmark.Range is readonly, so I cannot replace the range with the modified one.

    Monday, May 5, 2014 7:24 PM

Answers

  • How, exactly are you defining the range and trying to move the end? These methods work:

    Sub Demo()
    With ActiveDocument.Words.First
      MsgBox .Text
      .End = .End + 1
      MsgBox .Text
      .MoveEnd wdWord, 1
      MsgBox .Text
     .MoveEndUntil vbCr, wdForward
      MsgBox .Text
    End With
    '
    Dim Rng As Range
    Set Rng = ActiveDocument.Words.First
    With Rng
      MsgBox .Text
      .End = .End + 1
      MsgBox .Text
      .MoveEnd wdWord, 1
      MsgBox .Text
     .MoveEndUntil vbCr, wdForward
      MsgBox .Text
    End With
    End Sub


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Tuesday, May 6, 2014 8:12 AM