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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,073
Messages
6,122,976
Members
449,095
Latest member
Mr Hughes

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