Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
powerpointvba扩展_Vba_Powerpoint - Fatal编程技术网

powerpointvba扩展

powerpointvba扩展,vba,powerpoint,Vba,Powerpoint,如果某个单词出现在句子中,我想选择一个句子(完整的一行) 例如: 你好,我叫维诺德。我来自海得拉巴 节目: 如果在句子中找到hello这个词。 打印完整的句子“你好,我叫维诺德,我来自海得拉巴。” 我发现了一个在word VBA中使用Extends的程序。 我想用同样的电源点。 下面是代码的链接,供参考 您可以使用TextRange Dim sld As Slide, shp As Shape, sentence As TextRange For Each sld In ActivePresen

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

例如:

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

节目: 如果在句子中找到hello这个词。 打印完整的句子“你好,我叫维诺德,我来自海得拉巴。”

我发现了一个在word VBA中使用Extends的程序。 我想用同样的电源点。 下面是代码的链接,供参考


您可以使用
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
将sld变暗为幻灯片,将shp变为形状,将句子变为文本范围
对于ActivePresentation.Slides中的每个sld
对于sld形状中的每个shp
如果是shp.HasTextFrame,则
对于shp.TextFrame.TextRange.句子中的每个句子
如果不是句子,那么Find(“hello”,“msoTrue”)什么都不是
调试。打印句子'