skip to main |
skip to sidebar
[抜粋]
ドキュメントプロパティを操作するオブジェクトライブラリが以下のページからダウンロードできます。
http://support.microsoft.com/support/kb/articles/q224/3/51.asp
DSOFILE.EXE Lets You Read Document Properties Without Office Installed
ただ、以前試してみたのですが、確か全角文字がうまく通らなくて文字列値の長さを2倍にして渡すような、少々トリッキーなことをした記憶があります。C++などでプログラムを自作する方が確実かもしれません。
Windows 98 SE + Excel 2000 で、以下の手順で試したと記憶しています。
(1) Dsofile.exe を解凍、dsofile.dll を Windows\System フォルダへコピー。
(2) regsvr32 dsofile.dll を実行
(3) Excel で新規ブックを作成、Visual Basic Editor の [ツール]-[参照設定]で dsofile.dll(または DS: OLE Document Properties 1.2 Object Library)
を参照設定。
(4) 標準モジュールを挿入し、以下のコードをテスト。
Sub Test()
Dim oFilePropReader As DSOleFile.PropertyReader
Dim oDocProp As DSOleFile.DocumentProperties
Dim sFile As String
" sFile = ""C:\My documents\Book1.xls"""
Set oFilePropReader = New DSOleFile.PropertyReader
Set oDocProp = oFilePropReader.GetDocumentProperties(sFile)
Debug.Print oDocProp.Author
Set oDocProp = Nothing
Set oFilePropReader = Nothing
End Sub
ドキュメントはないようですが、サンプルコードは FileProp.frm にありました。
(テキストエディタで読めます)