Hello Everyone,
Is it possible to allow user to select a specific textbox using VBA and get word-count of that textbox?
thanks
Hello Everyone,
Is it possible to allow user to select a specific textbox using VBA and get word-count of that textbox?
thanks
Maybe this will give you some ideas.
Code:Option Explicit
Sub CountSomeWords()
' Example of how to use WordsOnSlide
Dim oSl As Slide
Dim lWordCount As Long
For Each oSl In ActivePresentation.Slides
lWordCount = lWordCount + WordsOnSlide(oSl)
Next
MsgBox lWordCount
End Sub
Function WordsOnSlide(oSl As Slide) As Long
' Gives APPROXIMATE word count of the words in
' text boxes and normal shapes on a slide
' Does not count shapes in groups, text in charts
' smart art, graphics, etc.
Dim oSh As Shape
Dim lCount As Long
For Each oSh In oSl.Shapes
If oSh.HasTextFrame Then
If oSh.TextFrame.HasText Then
lCount = lCount + oSh.TextFrame.TextRange.Words.Count
End If
End If
Next
WordsOnSlide = lCount
End Function