Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12141

Find Function VBA Named Argument Not Found

$
0
0

I am writing a macro that runs through a Word document and highlights 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.

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 iEnd Sub

Viewing all articles
Browse latest Browse all 12141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>