无法设置Excel文件的BuiltinDocumentProperties
我想以编程方式设置Excel文件的元数据。
如果我在VBA中运行这个代码,
ActiveWorkbook.BuiltinDocumentProperties.Items("Title").Value = "Hi, there!!!"
我得到一个“对象不支持这个属性或方法”的exception
Excel格式(2003或2010)没有什么区别。
我不能在MS文档中直接确认,但我怀疑BuiltinDocumentProperties
只读在Excel中。
这是对的吗?
这是Item
,而不是Items
,但它是默认的方法,所以没有必要:
ActiveWorkbook.BuiltinDocumentProperties("Title").Value = "hi there"
如果从另一个应用程序中自动化Excel,可能/通常需要包含Item
:
ActiveWorkbook.BuiltinDocumentProperties.Item("Title").Value = "hi there"