Thread: [Solved] Range.Collapse?
View Single Post
 
Old 01-12-2013, 09:47 PM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Range.Collapse?

Code:
Sub FindUntiltheEndofDocument()

Dim oRange As Range
Set oRange = ThisDocument.Range(0, 0)
With oRange.Find
    .ClearFormatting
    .MatchCase = False
    .Text = "cat"
    While .Execute
        oRange.Select
'' Why is it needed?
        oRange.Collapse Direction:=wdCollapseEnd
    Wend
Set oRange = Nothing
End With

End Sub
Even without the line,
Code:
        oRange.Collapse Direction:=wdCollapseEnd
it is still the same in effect as with this line of codes.

Why is the range needed to be collapsed to the end then?
Reply With Quote