返回一个 DocumentProperties 集合,该集合代表指定工作簿的所有内置文档属性。只读。
本属性返回的是内置文档属性的整个集合。通过指定属性的名称或集合中的索引号(数字),用 Item 方法可返回集合中的单个成员(一个 DocumentProperty 对象)。
可通过索引值或名称来引用文档属性。下面的列表显示的是可用的内置文档属性的名称:
Title
Subject Author Keywords Comments Template Last Author Revision Number Application Name Last Print Date |
Creation Date
Last Save Time Total Editing Time Number of Pages Number of Words Number of Characters Security Category Format Manager |
Company
Number of Bytes Number of Lines Number of Paragraphs Number of Slides Number of Notes Number of Hidden Slides Number of Multimedia Clips Hyperlink Base Number of Characters (with spaces) |
无须通过容器应用程序对每一内置文档属性值进行定义。如果 Microsoft Excel 对某个内置文档属性值没有定义,则读取该文档属性的 Value 属性时将产生错误。
由于 Item 方法是 DocumentProperties 集合的默认方法,所以下列语句是相同的:
BuiltinDocumentProperties.Item(1)
BuiltinDocumentProperties(1)
使用 CustomDocumentProperties 属性可返回自定义文档属性的集合。
本示例在第一张工作表中以列表的形式显示所有内置文档属性的名称。
rw = 1
Worksheets(1).Activate
For Each p In ActiveWorkbook.BuiltinDocumentProperties
Cells(rw, 1).Value = p.Name
rw = rw + 1
Next