![]() |
|
#1
|
|||
|
|||
|
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
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Word table - how do I append % symbol to each value in columns 3 & 4 of a table | Dawsie | Word | 4 | 03-06-2013 12:33 AM |
Insert text at the end of a sentence Find/Replace
|
AlmostFriday | Word | 6 | 06-17-2012 05:21 AM |
Deleteing specific text in word document
|
ubns | Word | 1 | 05-31-2012 10:38 PM |
Change on 1 sentence applied to the whole text
|
flexible | Word | 2 | 05-03-2012 02:25 AM |
| Append text to a cell with color | gvdm | Excel | 1 | 04-17-2012 10:21 AM |