View Single Post
 
Old 02-25-2020, 05:37 AM
pushpi004 pushpi004 is offline Windows 10 Office 2016
Novice
 
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