簡體   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