View Single Post
 
Old 12-30-2023, 08:04 AM
RobiNew RobiNew is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 200
RobiNew is on a distinguished road
Default

Hi, Vivka! I'm again in trouble. I'm trying to modify the code below (taken from the one above, #9) so as to select all the words that precede the comma in the first paragraph. In other words I need to select from paragraph start to the comma. Can you help? Thanks!
Code:
Set oRng = ActiveDocument.Paragraphs(1).Range
oRng.Select
   If InStr(1, oRng, ",") > 0 Then
   oRng.Collapse
      oRng.MoveUntil Cset:=",", Extend
'Extend from paragraph start until comma
   End If
Reply With Quote