Find Function VBA Named Argument Not Found-Runtime error 448

meibr2

New Member
Joined
Mar 16, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am writing a macro( late binding) that runs through a word document and highlight all the values that is contained in my cell range in Excel. I have used the find function which works fine until I add the argument IgnoreSpace:= True, which I don't understand why it's resulting in error. Appreciate any help


VBA Code:
Sub Highlight()
    Dim lrow As Long
    lrow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
     Dim i As Long
       Dim myRange As Object
        Dim FindText As Object

        Set myRange = ActiveDocument.Content


       For i = 1 To lrow Step 1

       myRange.Find.Execute FindText:=Sheet1.Range("A" & i).Value, MatchCase:=False, _
        IgnoreSpace:=True, Forward:=True, MatchWholeWord:=True

      If myRange.Find.Found = True Then myRange.HighlightColorIndex = wdYellow
      Next i
      End Sub
 
I've never thought Microsoft's documentation was good, but this is the first time I've seen it flat-out wrong.
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top