【问题标题】:Extracting All Comments from PPT Slide using VBA使用 VBA 从 PPT 幻灯片中提取所有评论
【发布时间】:2017-03-15 14:53:17
【问题描述】:

在研究过程中,我发现以下链接,

Extracting comments from a PowerPoint presentation using VBA

以下是针对此类问题提供的解决方案。

Sub ConvertComments()
''# Converts new-style comments to old

    Dim oSl As Slide
    Dim oSlides As Slides
    Dim oCom As Comment
    Dim oShape As Shape


    Open "filename.txt" For Output As 1
    Set oSlides = ActivePresentation.Slides

    Dim myContext As String
    For Each oSl In oSlides
        For Each oCom In oSl.Comments
            myContext = ""
            For ShapeIndex = oCom.Parent.Shapes.Count To 1 Step -1
                myContext = myContext & oCom.Parent.Shapes(ShapeIndex).AlternativeText & " "
            Next
            Write #1, oCom.Author & ";" & myContext & ";" & oCom.Text
        Next oCom
    Next oSl
    Close 1
End Sub

我发现这个脚本没有获取幻灯片中的回复 cmets,它仅从幻灯片中获取主要 cmets,我还尝试更新此解决方案以从幻灯片中获取所有 cmets,运气不好我找不到解决方案。

【问题讨论】:

  • 您发布的代码显然是在我的网站上开始使用的。这很好,但它不再像原来那样做(将 cmets 从新样式转换为旧样式),因此为避免混淆,您可能需要更改子例程的名称并删除它下面的注释行。

标签: macos vba powerpoint


【解决方案1】:

这是一个示例,将显示幻灯片 1 及其下方的每条评论、评论的回复数量、每条回复的作者和文本:

Sub Example()

    Dim oCom As Comment
    Dim x As Long

    For Each oCom In ActivePresentation.Slides(1).Comments
        With oCom
            Debug.Print .Author & vbCrLf & vbTab & .Text
            Debug.Print .Replies.Count
            For x = 1 To .Replies.Count
                With .Replies(x)
                    Debug.Print vbTab & .Author & vbTab & .Text
                End With
            Next
        End With
    Next

End Sub

这在 2016 年有效;我不确定 2013 年,我知道它不会在 2010 年(及更早)工作,因为它无法输入对 cme​​ts 的回复。 2016 年输入的回复将转换为多个 cmets。

【讨论】:

    猜你喜欢
    • 2023-02-10
    • 2019-11-15
    • 2010-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-27
    • 1970-01-01
    • 2022-06-10
    相关资源
    最近更新 更多