【发布时间】:2022-01-19 00:16:12
【问题描述】:
有人要求我帮助我在 Word 中获取评论的段落编号。注意,Word VBA 不是我的强项。进行了一些搜索后,我整理了一个提取 cmets 本身的示例,但不确定如何获取段落编号。
在下面的示例中,我想提取注释(作为单词注释插入)和相关的段落编号,即:
评论 1 - 1.1.1.1
评论 2 - 1.1.1.3
评论 3 - 1.1.2.1.1
下面的示例代码。我如何访问段落级别属性,到目前为止我的尝试都没有产生任何结果并且我在文档中找不到它。
Public Sub ExtractComments()
Dim oDoc As Document
Dim nCount As Long
Dim n As Long
Set oDoc = ActiveDocument
nCount = ActiveDocument.Comments.Count
'Get info from each comment from oDoc and insert in table
For n = 1 To nCount
Debug.Print (oDoc.Comments(n).Scope.Information(wdActiveEndPageNumber))
Debug.Print (oDoc.Comments(n).Scope.Information(wdFirstCharacterLineNumber))
Debug.Print (oDoc.Comments(n).Scope.ParagraphStyle)
Debug.Print (oDoc.Comments(n).Scope.Paragraphs(1).Range.ListFormat.ListString)
Next n
Set oDoc = Nothing
End Sub
【问题讨论】: