2013-06-27 22 views
0

我想以编程方式设置Excel文件的元数据。无法设置Excel文件的BuiltinDocumentProperties

如果我运行VBA这个代码,

ActiveWorkbook.BuiltinDocumentProperties.Items("Title").Value = "Hi, there!!!" 

我得到一个“对象不支持此属性或方法”例外

Excel格式(2003年或2010年)不有所作为。

我无法在MS文档中获得直接确认,但我怀疑BuiltinDocumentProperties只能在Excel中读取。

它是正确的吗?

回答

3

这是Item,不Items,但它是默认的方法,这样是没有必要的:

ActiveWorkbook.BuiltinDocumentProperties("Title").Value = "hi there" 

这可能是/通常要包括Item如果从另一个应用程序自动化Excel:

ActiveWorkbook.BuiltinDocumentProperties.Item("Title").Value = "hi there"