I Would like to select a sentence (complete line) if a certain word occurs in the sentence.
For example:
Sentence : Hello My name is vinod. I am from Hyderabad.
Program: If the word hello is found in the sentence. Print complete sentence "Hello My name is vinod. I am from Hyderabad."
I found a program which uses Extends in word VBA. I would like to use the same for Power Point. here is the link for the code for reference
You can use the Sentences
attribute of the TextRange
Dim sld As Slide, shp As Shape, sentence As TextRange
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
For Each sentence In shp.TextFrame.TextRange.Sentences
If Not sentence.Find("hello", , , msoTrue) Is Nothing Then
Debug.Print sentence ' <-- do the action you want on the sentence
End If
Next
End If
Next
Next
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.