Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
No more than 15
The following code in a macro will do what you want
Dim i As Long, myrange As Range, j As Long For i = 1 To ActiveDocument.Paragraphs.Count j = InStr(ActiveDocument.Paragraphs(i).Range.Text, "=") If j 16 Then Set myrange = ActiveDocument.Paragraphs(i).Range myrange.End = myrange.Start + j - 1 myrange.Text = Left(myrange.Text, 15) End If Next i -- Please respond to the Newsgroup for the benefit of others who may be interested. Questions sent directly to me will only be answered on a paid consulting basis. Hope this helps, Doug Robbins - Word MVP "Steved" wrote in message ... Hello from Steved The Boy Can Sing= by Danehill,$1,345 The Boy Can Sin= by Danehill,$1,345 The objective please is to have a formula that will search the entire document and Any word or words longer than 15 includes spaces after 15 to be deleted to leave as above, anythinh after the = does not matter in other words it can be as long as it needs to be. It is only before the = sign that I need a formula for please. Thankyou. |
#2
|
|||
|
|||
Thankyou.
-----Original Message----- The following code in a macro will do what you want Dim i As Long, myrange As Range, j As Long For i = 1 To ActiveDocument.Paragraphs.Count j = InStr(ActiveDocument.Paragraphs (i).Range.Text, "=") If j 16 Then Set myrange = ActiveDocument.Paragraphs(i).Range myrange.End = myrange.Start + j - 1 myrange.Text = Left(myrange.Text, 15) End If Next i -- Please respond to the Newsgroup for the benefit of others who may be interested. Questions sent directly to me will only be answered on a paid consulting basis. Hope this helps, Doug Robbins - Word MVP "Steved" wrote in message ... Hello from Steved The Boy Can Sing= by Danehill,$1,345 The Boy Can Sin= by Danehill,$1,345 The objective please is to have a formula that will search the entire document and Any word or words longer than 15 includes spaces after 15 to be deleted to leave as above, anythinh after the = does not matter in other words it can be as long as it needs to be. It is only before the = sign that I need a formula for please. Thankyou. . |