You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:如何通过PowerPoint VBA获取评论的Resolved/Open状态

获取PowerPoint评论的解决状态(Resolved/Open)的VBA实现

PowerPoint VBA里的Comment对象自带ResolutionStatus属性,直接用它就能判断评论的解决状态。这个属性返回枚举值,对应关系明确:

  • ppCommentResolutionStatusResolved(数值1):评论已解决
  • ppCommentResolutionStatusOpen(数值0):评论待处理

结合你已有的遍历逻辑,下面是完整的示例代码,包含提取作者、评论文本和状态的实现:

Sub GetCommentStatus()
    Dim oPres As Presentation
    Dim oSlide As Slide
    Dim oComment As Comment
    Dim statusText As String
    
    Set oPres = ActivePresentation
    
    ' 遍历演示文稿所有幻灯片
    For Each oSlide In oPres.Slides
        ' 遍历当前幻灯片的所有评论
        For Each oComment In oSlide.Comments
            ' 根据枚举值转换为可读状态文本
            Select Case oComment.ResolutionStatus
                Case ppCommentResolutionStatusOpen
                    statusText = "Open(待处理)"
                Case ppCommentResolutionStatusResolved
                    statusText = "Resolved(已解决)"
                Case Else
                    statusText = "未知状态"
            End Select
            
            ' 输出评论信息(可按需改为写入文件/Excel等)
            Debug.Print "幻灯片编号: " & oSlide.SlideIndex _
                & " | 作者: " & oComment.Author _
                & " | 评论内容: " & oComment.Text _
                & " | 状态: " & statusText
        Next oComment
    Next oSlide
    
    ' 释放对象
    Set oComment = Nothing
    Set oSlide = Nothing
    Set oPres = Nothing
End Sub

注意事项

  1. 该属性支持Office 2016及以上版本,若使用更早版本需先确认兼容性
  2. 代码用Debug.Print输出到VBA编辑器的立即窗口,你可以根据需求修改输出目标(比如写入Excel单元格、生成文本报告)

内容的提问来源于stack exchange,提问作者VBA Questions

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 19:47:02