1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Find and Replace

Discussion in 'ASP' started by kalees, Sep 30, 2006.

  1. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I have to find and replace the given words in a word document. but my program always replace the words with the first value of the replace string array. please anyone help me what is wrong in the code,
    Code:
    objWordobject.Selection.Find.ClearFormatting
        objWordobject.Selection.Find.Replacement.ClearFormatting
     	
        With objWordobject.Selection.Find
              .Forward = True
              .Wrap = wdFindContinue
              .FORMAT = True
              .MatchCase = False
              .MatchWholeWord = False
              .MatchWildcards = False
              .MatchSoundsLike = False
              .MatchAllWordForms = False
       do while not findRs.eof
      
                 .Text = findRs(1)
             
    		for i= LBound(vReplText) To  UBound(vReplText)
                 .Replacement.Text = vReplText(i)
    			      
    			 .Execute ,,,,,,,,,,wdReplaceAll
                
             Next     
          findRs.movenext
    	  loop
    
    End With
    Thanks,
    Kalees
     
    Last edited by a moderator: Oct 1, 2006

Share This Page