繁体   English   中英

遍历所有幻灯片并获得PowerPoint中的字符数

[英]Iterate through all slides and get the count of characters in powerpoint

我有一个脚本可以循环浏览一张幻灯片,并以文字形式写出文字

Sub Sample()
Dim textShapes() As Shape, i as Long

ReDim textShapes(0 To 2)

i = 0

For Each thisShape In ActivePresentation.Slides(1).Shapes
    If thisShape.HasTextFrame Then
        If thisShape.TextFrame.HasText Then
           Set textShapes(i) = thisShape
           i = i + 1
           ReDim Preserve textShapes(0 To i) As Shape
        End If
     End If
Next thisShape

Debug.Print textShapes(1).TextFrame.TextRange.Text End Sub

但是,我想遍历所有幻灯片并从所有幻灯片的形状和占位符中获取字符数

希望代码可以使用redim保留数组进行调整,但出现错误。

我正在寻找一个脚本,该脚本可以向我传达所有幻灯片中的字符数信息

请同样帮我。

尝试为每个嵌套:

For Each slide In ActivePresentation.Slides
    For Each thisShape In slide.Shapes
        If thisShape.HasTextFrame Then
            If thisShape.TextFrame.HasText Then 
               Set textShapes(i) = thisShape
               i = i + 1
               ReDim Preserve textShapes(0 To i) As Shape   
            End If
        End If
    Next thisShape
Next slide

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM