Officeファイルのプロパティを編集する (BuiltInDocumentProperties)
エクセルのプロパティ編集のコードを探していて、OfficeのうちWord, Excel, PowerPointにはBuiltInDocumentPropatiesとCustomDocumentPropatiesというものがあることが分かり、このうちBuiltInDocumentPropatiesについて調べてみました。
- Word, Excel, PowerPointのみに対応
- Access, Outlookなどには対応しない
'**Word ActiveDocument.BuiltInDocumentProperties(n) '**Excel ActiveWorkbook.BuiltInDocumentProperties(n) '**PowerPoint ActivePresentation .BuiltInDocumentProperties(n)
各アプリケーションの対応表
番号 | Property | プロパティ名(日本語) | Word | Excel | PowerPoint |
---|---|---|---|---|---|
1 | Title | 表題(タイトル) | ○ | ○ | ○ |
2 | Subject | 副題(サブタイトル)/件名 | ○ | ○ | ○ |
3 | Author | 作成者 | ○ | ○ | ○ |
4 | Keywords | タグ(キーワード) | ○ | ○ | ○ |
5 | Comments | コメント | ○ | ○ | ○ |
6 | Template | テンプレート名 | ○ | △ | △ |
7 | Last author | 最終更新者 | ○ | ○ | ○ |
8 | Revision number | 改訂番号 | ○ | ● | ○ |
9 | Application name | アプリケーション名 | ○ | ○ | ○ |
10 | Last print date | 前回印刷日 | ○ | ○ | ○ |
11 | Creation date | 作成日時 | ○ | ○ | ○ |
12 | Last save time | 最終更新日 | ○ | ○ | ○ |
13 | Total editing time | 編集時間(min) | ○ | × | ○ |
14 | Number of pages | ページ数 | ○ | × | × |
15 | Number of words | 単語数 | ○ | × | ○ |
16 | Number of characters | 文字数(スペースを含まない) | ○ | × | × |
17 | Security | パスワード保護(1or0) | ○ | ○ | × |
18 | Category | 分類 | ○ | ○ | ○ |
19 | Format | フォーマット | △ | △ | ○ |
20 | Manager | 管理者 | ○ | ○ | ○ |
21 | Company | 会社 | ○ | ○ | ○ |
22 | Number of bytes | バイト数 | ○ | × | × |
23 | Number of lines | 行数 | ○ | × | × |
24 | Number of paragraphs | 段落数 | ○ | × | ○ |
25 | Number of slides | スライド数 | × | × | ○ |
26 | Number of notes | メモ数 | × | × | ○ |
27 | Number of hidden Slides | 非表示のスライド数 | × | × | ○ |
28 | Number of multimedia clips | マルチメディアクリップの数 | × | × | ○ |
29 | Hyperlink base | ハイパーリンクの基点 | ○ | ○ | ○ |
30 | Number of characters (with spaces) | 文字数(スペースを含む) | ○ | × | × |
31 | Content type | Content type | ▲ | ▲ | ▲ |
32 | Content status | 状態 | ○ | ○ | ○ |
33 | Language | 言語 | ● | ● | ● |
34 | Document version | バージョン番号 | ● | ● | ● |
- 凡例
- ○:対応しており値もある
- △:対応しているが値はない
- ×:対応していない
- ●:対応しており値もあるが、コードでは表示できず、エクスプローラ>プロパティ>詳細で表示と設定が可能
- ▲:対応しており値もあるが、コードでは表示できず、エクスプローラ>プロパティ>詳細で表示のみ可能
各アプリケーションで対応していない番号のコードはエラーになります。
'**Excel Msgbox ActiveWorkbook.BuiltInDocumentProperties(24)
以上。