首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Power Point VBA扩展

Power Point VBA扩展
EN

Stack Overflow用户
提问于 2017-01-28 18:49:04
回答 1查看 30关注 0票数 0

如果句子中出现某个单词,我想选择一个句子(完整的一行)。

例如:

句子:你好,我叫维诺德。我来自海得拉巴。

程序:如果在句子中找到单词hello。打印完整的句子“你好,我的名字是维诺德。我来自海得拉巴。”

我在word VBA中找到了一个使用扩展的程序。我想在Power Point中使用同样的方法。以下是代码的链接以供参考

Extract sentences containing a specific word to excel file

EN

回答 1

Stack Overflow用户

发布于 2017-01-28 19:37:29

您可以使用TextRangeSentences属性

代码语言:javascript
运行
复制
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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41908884

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档