Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 02-25-2020, 05:37 AM
pushpi004 pushpi004 is offline Find, Replace using Excel List Windows 10 Find, Replace using Excel List Office 2016
Novice
Find, Replace using Excel List
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default Issue with plurals

Hi Paul,

I have found the solution for my problem. The issue with .MatchAllWordForms is that it does not work if the word/string consists of more than a word. So, using instr(.text, " "), i checked if the .text from xlFlist has space or not. If yes, then, I used .MatchWholeWord=True, else, I used MatchAllWordForms=true. The results of this simple if else construct gave the answer. thus, there is no requirement of creating a separate F/R list of plurals.

THE CODE I USED IS COPIED BELOW :-

Code:
With wdDoc
      With .Range.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Replacement.Highlight = True      
        .MatchCase = False
        .Wrap = wdFindContinue
        For i = 1 To UBound(Split(xlFList, "|"))
          .Text = Split(xlFList, "|")(i)           
          'checking if checked word has spaces i.e. it comprises of multiple words
          If InStr(.Text, " ") = 0 Then           
          .MatchWholeWord = False
          .MatchAllWordForms = True           
          .Replacement.Text = Split(xlRList, "|")(i)          
          .Execute Replace:=wdReplaceAll
          Else
           .MatchAllWordForms = False
           .MatchWholeWord = True          
          .Replacement.Text = Split(xlRList, "|")(i)          
          .Execute Replace:=wdReplaceAll
          End If
        Next
      End With
Thanks again for your help.

Regards

Last edited by macropod; 02-26-2020 at 04:10 AM. Reason: Added code tags
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and replace multiple values, according to table value - excel formula EtanM Excel Programming 3 04-11-2016 01:43 AM
Find, Replace using Excel List Find and Replace different in Excel 2010? admyers Excel 1 09-16-2015 10:28 AM
Find/Replace is not working - Excel 2010 fieldhaven Excel 2 02-19-2014 08:30 AM
Find - Replace Macro using a table list mdw Word 0 08-01-2013 04:36 PM
Find, Replace using Excel List Find and Replace using Excel range dmarie123 Word VBA 15 04-02-2013 07:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:49 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