Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue]Sub CountWords()
Dim R As Range
Dim W As String
W = InputBox("Please enter word to count until:")
If W <> "" Then
Set R = Selection.Range
R.Collapse wdCollapseEnd
If R.Find.Execute(W) Then
R.Start = Selection.End
MsgBox "There are " & R.Words.Count & _
" words between the current selection and """ _
& W & """"
Else
MsgBox """" & W & """ not found."
End If
End Sub[/blue]
Sub CountToHere()
Dim r As Range
Set r = Selection.Range
With r
.Expand Unit:=wdWord
.Collapse 1
.Start = ActiveDocument.Range.Start
End With
MsgBox r.ComputeStatistics(wdStatisticWords)
End Sub