ontopic:
In welke versie van Word wil je het doen? (97/2000/XP).
Ik neem aan dat je een stuk VBA wilt bakken met een leuk formuliertje ?
Als je mij duidelijk kan maken waar je het voor wilt gebruiken, dan kan ik het antwoord daar op aanpassen.
Je kan namelijk ergens een icoontjes maken dat er een popup-windowtje komt met het aantal woorden, maar je kan ook hele formulieren maken met allerlei statistieken.
Het aantal woorden kan je rechtstreeks uit word zelf halen.
Rechtstreeks uit de help van VBA
als je een tekst geselecteerd hebt:
code:
1
2
3
4
5
6
7
| This example displays the number of words in the selection.
If Selection.Words.Count >= 1 And _
Selection.Type <> wdSelectionIP Then
MsgBox "The selection contains " & Selection.Words.Count _
& " words."
End If |
Als je gewoon een VBA userform wilt gebruiken, dan kan je het beste de statistieken van het document uitlezen. Zo voorkom je dat Word opnieuw alles gaat tellen, terwijl ie dat al gedaan heeft.
Magic Keyword in deze is: ReadabilityStatistics.
Klik maar s op File--> Properties.
Voila: Statistieken windowtje (in Word XP althans)
In de help staat dit:
Using the ReadabilityStatistic Object
Use ReadabilityStatistics(index), where index is the index number, to return a single ReadabilityStatistic object. The statistics are ordered as follows: Words, Characters, Paragraphs, Sentences, Sentences per Paragraph, Words per Sentence, Characters per Word, Passive Sentences, Flesch Reading Ease, and Flesch-Kincaid Grade Level. The following example returns the character count for the active document.
Msgbox ActiveDocument.Content.ReadabilityStatistics(2).Value