【问题标题】:Power Point VBA ExtendsPower Point VBA 扩展
【发布时间】:2017-01-29 00:37:23
【问题描述】:

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

例如:

句子:你好,我的名字是 vinod。我来自海得拉巴。

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

我找到了一个在 word VBA 中使用 Extends 的程序。 我想对 Power Point 使用相同的方法。 这是代码的链接供参考

Extract sentences containing a specific word to excel file

【问题讨论】:

    标签: vba powerpoint


    【解决方案1】:

    您可以使用TextRangeSentences 属性

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-01
      • 2010-09-27
      • 1970-01-01
      • 2017-04-17
      • 1970-01-01
      • 2021-09-23
      • 1970-01-01
      相关资源
      最近更新 更多