How to counting words in a string variable?

J

JS

Hi All:
Sorry to ask so many questions - I need to count words, using the
Words.Count Method, in a variable declared as String.
Does anyone know how to do this? I'm being unsuccessful in getting this text
in a TextRange that Words.Counts wants.
Thanks in advance for your help, JS
 
B

Brian Reilly, MVP

This works for me here.
MsgBox ActiveWindow.Selection.SlideRange.Shapes("Rectangle
3").TextFrame.TextRange.Words.Count

Brian Reilly, MVP
 
J

JS

Hi Steve and Shyam:
Steve and Shyam, sorry for posting this question - I thought that since it
was a new question to an answer to another question that it had got lost
under the proverbail stack... my fault... I'm taken back by the so different
way 2000 and 2003 treat the WholeWords parameter in the Replace Method - it
basically ruined all my Find&Replace I've been using for years!
Again, sorry nad thanks for your suggestion.
Rgds, JS
 
J

JS

Hi Brian,
Thanks for your reply.
Rgds, JS

Brian Reilly said:
This works for me here.
MsgBox ActiveWindow.Selection.SlideRange.Shapes("Rectangle
3").TextFrame.TextRange.Words.Count

Brian Reilly, MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top