2014-10-06 46 views
0

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

我一直在研究长期:(没有运气,我发现这个链接 http://www.aspose.com/community/forums/thread/202068/question-about-document.builtindocumentproperties.security.aspx

,这样的事情,但没有阅读Aspose

回答

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 
+0

谢谢ZAT,但我的意思是我想想让它不可编辑的(文件>的说明>的意见)。未将评论设置为“只读”文字。评论可能是任何东西,但它必须被锁定。我一直在研究很长时间:(没有运气,我发现这个链接http://www.aspose.com/community/forums/thread/202068/question-about-document.builtindocumentproperties.security.aspx,类似的东西,但没有ASPOSE – 2014-10-06 14:29:01

+0

查看更新的答案。最重要的是,您可以保护您的工作簿免受修改,但我没有测试过。 – ZAT 2014-10-06 20:41:05