我想使用 VBA在导出的 Word 文档 (.docx) 中删除所有受保护的评论。
评论受到它们所依赖的某种字段的保护(但是,无论有没有 VBA,我都找不到删除这种保护的方法)。从应用程序(Polarion ALM)导出时会生成这些“字段”。
我试图在 Word Macros 中删除受保护的评论:
Sub MakroRemoveComment()
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=strPassword
End If
ActiveDocument.DeleteAllComments
End Sub
但我最终得到以下错误消息:
对象“comment”的方法“DeleteAllComments”失败。
我想这是由于评论字段的保护。
截屏: