TRaP
Moderator
Inregistrat: acum 7 ani
Postari: 811
|
|
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:
Modificat de TRaP (acum 6 ani)
|
|