Tony is correct...as usual. vbCr works, and is more technically correct. Cset will find the CR - Chr(13) - before the Chr(10).
I would recommend playing with Cset before you use it seriously. You have to read Help (under the item MoveEndUntil) very carefully.
"Moves the end position of the specified range or selection until
any of the specified characters are found in the document. If the movement is forward in the document, the range or selection is expanded."
My bolding. This is VERY significant!
Say you have a document with the total content:
Yadda yadda blah whatever.
Run the following.
Code:
Sub bleech()
Dim r As Range
Dim var
Set r = ActiveDocument.Range(0, 0)
MsgBox r.Text
var = r.MoveEndUntil(Cset:="whatever")
r.Select
MsgBox var & " " & r.Text
End Sub
If Cset is a string (which it is) and the range end is moved until "whatever", you may think the new range selected would be:
Yadda yadda blah
I.e. just before "whatever". Cset moves the range end to just before the found Cset.
Except..... Cset moves the end to the first found instance of ANY (and more importantly, the
first) character in the Cset string. This is why Cset is rarely used (if at all) for more than a single character string.
The result of the code above will be a message box:
2 Y
2 being the returned number of characters moved. "Y" being the new range. Why? Because the
first found instance of ANY of the characters in the Cset string...is the "a" of "wh
atever". and that is at:
Y
a[/color red]dda yadda blah whatever.
Cset can be useful, but you really do have to know how it works.
faq219-2884
Gerry
My paintings and sculpture