-
That's really quite simple. You should spend a little time studying Word's API.
-
Hi
I was thinking of using
Code:
.Find(What=SearchWord)
, but it's currently using With .Find
Trying to make it look for Exact Word, if there are multiple similar words like :Apple, apple, Red Apple, red apple, I want it to make the SearchWord = "Apple" and get only that one for example. I think that would be called to find the Exact Match
This would take more time, so it's not viable, have to try with the .Find function for the Exact match
Code:
If InStr(TblCell.Range, SearchWord) Then
EDIT:
Did as below, find the MatchCase as Apple, but it doesen't go to the last result, it stops to the 1st encountered one, any idea how this can be done such as reaching the last found result? I've tried .Forward = True
Code:
Dim SearchWord As String
SearchWord = "Apple"
For Each wdTbl In .Tables
With wdTbl.Range
With .Find
.Text = SearchWord
.MatchCase = True
.MatchWholeWord = True
.Forward = True
.Wrap = wdFindStop
.Execute
End With
If .Find.Found = True Then
WkSht.Range("A" & 1).Value = Split(wdTbl.Cell(.Cells(1).RowIndex, .Cells(1).ColumnIndex+1).Range.Text, vbCr)(0)
Exit For
End If
End With
Next