Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-28-2014, 03:22 AM
dgp dgp is offline Append text to a sentence containing specific word Windows 7 32bit Append text to a sentence containing specific word Office 2007
Novice
Append text to a sentence containing specific word
 
Join Date: Feb 2014
Posts: 2
dgp is on a distinguished road
Default Append text to a sentence containing specific word

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
Reply With Quote
 



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
Append text to a sentence containing specific word Insert text at the end of a sentence Find/Replace AlmostFriday Word 6 06-17-2012 05:21 AM
Append text to a sentence containing specific word Deleteing specific text in word document ubns Word 1 05-31-2012 10:38 PM
Append text to a sentence containing specific word 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft