I was able to fix it by using the "Code" property instead of "result" to get the range. I guess it's because wdFieldToCEntry does not have a "result" like REF field does, since there's no place to input text. But I would think it would just return an empty value since technically all fields must have this property?
"That property is not available on this object" for Word field object property "result" when type is "wdFieldTOCEntry"
KSteele
66
Reputation points
Hello,
This following code works fine:
Dim FFrange As Range
For Each FF In ActiveDocument.Fields
If FF.Type = wdFieldRef Then
Set FFrange = FF.Result
'FFrange.HighlightColorIndex = wdRed
End If
Next
This following code generates "That propery is not available on this object"
Dim FFrange As Range
For Each FF In ActiveDocument.Fields
If FF.Type = wdFieldTOCEntry Then
Set FFrange = FF.Result
'FFrange.HighlightColorIndex = wdPink
End If
Next