Excel VBA为文件描述设置了BuiltinDocumentProperties>注释 - 设置为只读

时间:2014-10-06 03:11:15

标签: excel vba

如何在更新VBA代码中的注释后将Excel文件的BuiltinDocumentProperties注释设置为只读。不希望用户编辑excel文件的文件描述>注释。注意:我的问题是关于ntfs文件属性>详细信息选项卡>评论(BuiltinDocumentProperties),而不是excel单元格注释。任何帮助表示赞赏。

我一直在研究:(没有运气。我找到了这个链接 http://www.aspose.com/community/forums/thread/202068/question-about-document.builtindocumentproperties.security.aspx

,类似这样但没有ASPOSE

1 个答案:

答案 0 :(得分:0)

试试这个:

Sub ChangePropertyComment()
Dim NewComments As String

NewComments = InputBox("Enter Comments", "Change Comments Property")  'use for dynamic comment
'NewComments = "Read Only"                                         'use for predefined comment

ThisWorkbook.Comments = NewComments
ThisWorkbook.Save
End Sub

<强>所附:

弱的解决方法:

Private Sub Workbook_Open()      
ThisWorkbook.Comments = "locked"
ThisWorkbook.Final = True
End Sub

良好的解决方法:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ThisWorkbook.Comments = "locked"
End Sub