-
Count words with VBA
Hi all,
Someone asked on another forum if they could count words in Access as is shown in Word in the status bar.?
Besides using Split(), I was thinking, you could use Word to do it?
So I pasted some text and then used ActiveDocument.Words.Count to display the count, which was 75, yet the status bar shows words as 69.
This was a new document and a simple copy and paste.
What could cause the discrepancy?
TIA
Edit: A Split() on a single space actually produces 69 ? Ubound being 68.
-
Found out why.
Need to use ActiveDocument.Range.ComputeStatistics(wdStatisticWords) to get matching number to status bar
https://support.microsoft.com/en-us/...a-9da4ca22e3ff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules