i m trying this below code but getting error saying 'type mismatch'
[VBA]
MsgBox ActiveDocument.Words(Selection.Words(1))
[/VBA]
i m trying this below code but getting error saying 'type mismatch'
[VBA]
MsgBox ActiveDocument.Words(Selection.Words(1))
[/VBA]
There's a macro from Microsoft you can download:
Word 2000 Tool: Selection Word Count Macro:
http://www.microsoft.com/downloads/d...displaylang=EN
It allows you to see the code in the VBE so as to work out how it works.
If the above is abit overkill, or you don't have Word 2000, let me know and i'll post a macro to display what you require.
HTH,
Marcster.
If you want a count of the number of words in the current Selection you need to use the Words property of the Range of the Selection.
Try:
[vba]MsgBox Selection.Range.Words.Count[/vba]
Thankyou Gerry, Marcster. It is solved.