Add an epic real-time word counter in Word


Some quick steps on creating your own REAL-TIME word counter in Microsoft Word. And don’t be scared by the code. It’s as simple as copy and paste!

Open Microsoft Word
Type Alt+F11 (or navigate to Tools > Macro > Visual Basic Editor)
You should see a white text box. If not, click Insert > Module
Paste the code below into the text box
Go back to your word document
Type Alt+F8
Run the AutoExec macro

You should now see the real-time word counter at the top left of your word document

Here’s the code
Sub AutoExec()
End Sub

Sub NumberOfWords()
Dim lngWords As Long
Dim myRange As Range
With Word.Application
If .Windows.Count > 0 Then
Set myRange = ActiveDocument.Content
lngWords = myRange.ReadabilityStatistics(1).Value
.Caption = Format(lngWords, "##,##0") & " words - Microsoft Word"
.Caption = "Microsoft Word"
End If
.OnTime Now + TimeValue(OnTm(lngWords)), "NumberOfWords"
End With
End Sub

Private Function OnTm(ByVal lngWd As Long) As String
Select Case lngWd \ 1000
Case 0 To 10
OnTm = "00:00:01"
Case 11 To 20
OnTm = "00:00:05"
Case 21 To 30
OnTm = "00:00:10"
Case 31 To 40
OnTm = "00:00:15"
Case Else
OnTm = "00:00:20"
End Select
End Function



Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s