Hi,
I have two scenarios to automate.Appreciate if some one could help.
1) I need find all sentences having 'shall' as the word.The sentence has to be appended with a serial number.
Eg:-
a)XYZ
shall produce 10 units.Atleast 9 units
shall be functional.
b)ABX
shall deliver in 3 days.
For above scenario,I require below result
a)XYZ shall produce 10 units[R001].Atleast 9 units shall be functional[R002].
b)ABX shall deliver in 3 days[R003].
2)I need find all sentences having 'may' or 'should'as the word.The sentence has to be appended with a different serial number.
Eg:-
a)XYZ may be delivered by flight.Delay of 6 hours may be allowed.
b)ABX may deliver in wooden boxes.
For above scenario,I require below result
a)XYZ
may be delivered by flight[M001].Delay of 6 hours
may be allowed[M002].
b)ABX
should be delivered in wooden boxes[M003].
I tried below code but,it works for paragraphs and not sentences.
Code:
Sub NumberShallTags()
iParCount = ActiveDocument.Paragraphs.Count
cnt = 1
For J = 1 To iParCount
Set objParagraph = ActiveDocument.Paragraphs(J).Range
objParagraph.Find.Text = "shall"
objParagraph.Find.ClearFormatting
objParagraph.Find.Execute
If objParagraph.Find.Found Then
sMyPar = ActiveDocument.Paragraphs(J).Range.Text
ActiveDocument.Paragraphs(J).Range.Text = sMyPar + "[AMDB-" & Right("00" & Trim(CStr(cnt)), 3) + "]"
cnt = cnt + 1
End If
Next J
End Sub