Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Nou pe simpatie: simpacurly69 Profile
 | Femeie 24 ani Bucuresti cauta Barbat 35 - 70 ani |
|
|
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
|
| #1 |
TRaPModerator
Postari: 960
|
|
You have to select a paragraph / sentence / some words / characters, then run the following code and you will get a message box telling you how many words, characters with spaces and characters without spaces are in your selection:
Sub GetWordsCount_Selection()
Dim W, Ch, ChSp As Long
W = Selection.Range.ComputeStatistics(wdStatisticWords) Ch = Selection.Range.ComputeStatistics(wdStatisticCharacters) ChSp = Selection.Range.ComputeStatistics(wdStatisticCharactersWithSpaces)
MsgBox "The selection has:" & vbCrLf & _ " - " & W & " words." & vbCrLf & _ " - " & ChSp & " characters with spaces." & vbCrLf & _ " - " & Ch & " characters without spaces."
End Sub
|
Source: http://vba.relief.jp/word-vba-count-words-selection/
|
|
| |
|