タイトル欄のアドレスは、エクセルファンクラブの該当する頁へのリンク先です。
詳しい事は、こちらのお願いをご覧になってください。
1
ファイルのプロパティを取得するには
2
ワークシートの特定のプロパティが保存できない(Excel2000対象)
3
ファイルの最終保存日を取得するには?
1 | ファイルのプロパティを取得するには http://www.keep-on.com/~excelyou/2000lng4/200011/00110020.txt 「ファイルのプロパティを編集できますか?」 【VBAラウンジ】 |
||
1. 下記のページ(英語です)にアクセスして
http://support.microsoft.com/support/kb/articles/q224/3/51.asp 【MORE INFORMATION】のところの、dsofile.exe をダウンロードします。 2. ダウンロードしたファイルをダブルクリックしてインストールします。 メッセージが順番に表示されるので「はい」(もしくは「Yes」)ボタンを押して 先へ進んでください。 途中でインストール先を指示するダイアログが表示されるので適宜変更してください。 区切り記号(\)がスラッシュ(/)の逆向きの記号になってるので注意してね。 インストールが終わると「Installation complete」とメッセージが表示されるので OKボタンで閉じて終了させます。 3. 下記のコードを標準モジュールに書き込んで、実行します。 Sub ListFileProperties() Dim FileName As Variant Dim PropReader As Object Dim DocProp As Object FileName = Application.GetOpenFilename("エクセル ブック(*.xls),*.xls") If FileName = False Then Exit Sub FileName = FileName & String(LenB(FileName), vbNullChar) On Error Resume Next Set PropReader = CreateObject("DSOleFile.PropertyReader") Set DocProp = PropReader.GetDocumentProperties(FileName) If Err.Number <> 0 Then MsgBox "Error" Set PropReader = Nothing Set DocProp = Nothing Exit Sub End If On Error GoTo 0 With ActiveSheet .Cells.ClearContents .Cells(1, 1).Value = "ファイル名" .Cells(2, 1).Value = "タイトル" .Cells(3, 1).Value = "サブタイトル" .Cells(4, 1).Value = "作成者" .Cells(5, 1).Value = "管理者" .Cells(6, 1).Value = "会社名" .Cells(7, 1).Value = "カテゴリ" .Cells(8, 1).Value = "キーワード" .Cells(9, 1).Value = "コメント" .Cells(10, 1).Value = "クラスID" .Cells(11, 1).Value = "プログラムID" .Cells(12, 1).Value = "最終更新者" .Cells(13, 1).Value = "作成日" .Cells(14, 1).Value = "最終印刷日" .Cells(15, 1).Value = "最終保存日" .Cells(16, 1).Value = "バージョン" .Cells(17, 1).Value = "リビジョン" .Cells(18, 1).Value = "マクロ含有" .Cells(1, 2).Value = FileName .Cells(2, 2).Value = DocProp.Title .Cells(3, 2).Value = DocProp.Subject .Cells(4, 2).Value = DocProp.Author .Cells(5, 2).Value = DocProp.Manager .Cells(6, 2).Value = DocProp.Company .Cells(7, 2).Value = DocProp.Category .Cells(8, 2).Value = DocProp.Keywords .Cells(9, 2).Value = DocProp.Comments .Cells(10, 2).Value = DocProp.CLSID .Cells(11, 2).Value = DocProp.ProgId .Cells(12, 2).Value = DocProp.LastEditedBy .Cells(13, 2).Value = DocProp.DateCreated .Cells(14, 2).Value = DocProp.DateLastPrinted .Cells(15, 2).Value = DocProp.DateLastSaved .Cells(16, 2).Value = DocProp.Version .Cells(17, 2).Value = DocProp.RevisionNumber .Cells(18, 2).Value = DocProp.HasMacros .Columns.AutoFit End With Set DocProp = Nothing Set PropReader = Nothing End Sub このコードの使い方は、マクロの使い方(1)標準モジュールにあります。 |
|||
2 | ワークシートの特定のプロパティが保存できない(Excel2000対象) http://www.ae.wakwak.com/~efc21/cgi-bin/wwwlng.cgi?print+200107/01070158.txt 「AUTO_OPENとWorkbook_Openの違いについて?」 【VBAラウンジ】 |
||
ワークシートのプロパティを設定し保存した際、ブックを閉じて再度開くと、 設定が解除されている場合があります。 http://www.microsoft.com/japan/support/kb/articles/J056/6/39.htm これらのプロパティは、ブックを閉じる際に設定が保存されない仕様となっていますので、 規定値に戻ります。 プロパティ 規定値 DisplayPageBreaks False EnableAutoFilter False EnableCalculation True EnableOutlining False EnablePivotTable False EnableSelection 0 - xlNoRestrictions ScrollArea (設定なし) 再度ブックを開いたときに設定を有効にする場合、以下のような
Auto_Open マクロを |
|||
3 | ファイルの最終保存日を取得するには? http://www.keep-on.com/~excelyou/2000lng1/200008/00080038.txt 「最終保存日を取得したい」 【VBAラウンジ】 |
||
Function LastSave() LastSave = ThisWorkbook.BuiltinDocumentProperties(12) End Function このコードの使い方は、マクロの使い方(6) ユーザー定義関数にあります。 ※ 表示形式を日付にします。 |