I'm trying to get the last name in the first paragraph of a doc, but the code here below fails. The string is of this type: John R. Mate or John Rob Mate. Can someone help? Thanks!
Code:
Sub LastName()
Set oRng = ActiveDocument.Range
oRng.Collapse
oRng.MoveEndUntil Cset:=Chr(13)
oRng.Collapse wdCollapseEnd
oRng.Previous(Unit:=wdWord, Count:=1).Select
oRng.Select
'MsgBox oRng.Text
Sub End