Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Word counting w/o readabilityStatistics

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FotoArt - 02 Mar 2006 17:01 GMT
Hello everyone

Im trying to count the number of words in a document.
And the code below (taken off a web page somewhere)does a fine job showing
the result live, as long as I use it for english language text and perhaps
many others.
Unfortunately i use a different language module (Asian).

the problem occurs with the "readabilitystatistics" and I find that in my
document that function of Word is dimmed.

Could someone help me to incorporate a line of code to the following that
would calculate the number of words without using
"readabilityStatistics(1).value".

Sub AutoExec()
NumberOfWords
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"
   Else
       .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

------------
Any help in the right direction would be appreciated

thanx
ahmed
Word Heretic - 07 Mar 2006 15:14 GMT
G'day "FotoArt" <FotoArt@discussions.microsoft.com>,

IF AND ONLY IF said language supports the separation of words by
spaces (many asian languages DONT) you could Save As a temp copy,
ctrl+A, change language to eastern, then use the readability method.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

FotoArt reckoned:

>Hello everyone
>
[quoted text clipped - 50 lines]
>thanx
>ahmed
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.