Sub Demo() With ActiveDocument MsgBox .Range(0, InStr(.Range.Text, "My String")).ComputeStatistics(wdStatisticWords) - 1 End With End Sub