Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Retrieve Document Properties in Word
Hello,
I have several documents in one directory and would like to be able to run a report on these documents to list the document properties such as Category, Title, Last created? Can someone please help if there is a built in tool to accomplish this? Thank you and I look forward to your response. -- Smile...it is good for you! |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Retrieve Document Properties in Word
There's no built-in tool, but it is simple enough to achieve with a macro
http://www.gmayor.com/installing_macro.htm : Sub PropertiesReport() Dim strFileName As String Dim strPath As String Dim oDoc As Document Dim TargetDoc As Document Dim proDoc As DocumentProperty Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , _ "List Folder Contents" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" _ Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(strPath, 1) = Chr(34) Then strPath = Mid(strPath, 2, Len(strPath) - 2) End If strFileName = Dir$(strPath & "*.doc") Set TargetDoc = Documents.Add TargetDoc.Range.InsertAfter "Files in folder " & strPath & vbCr While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) With oDoc TargetDoc.Range.InsertAfter .name For Each proDoc _ In ActiveDocument.BuiltInDocumentProperties With TargetDoc.Range .InsertParagraphAfter .InsertAfter proDoc.name & "= " On Error Resume Next .InsertAfter proDoc.Value End With Next TargetDoc.Range.InsertParagraphAfter .Close SaveChanges:=wdSaveChanges End With strFileName = Dir$() Wend For Each oPara In TargetDoc.Paragraphs If InStr(1, oPara.Range, "=") = 0 Then oPara.Range.Style = "Heading 2" Else oPara.Range.Font.Size = 10 With oPara.Range.ParagraphFormat .LeftIndent = CentimetersToPoints(5) .RightIndent = CentimetersToPoints(0) .SpaceBefore = 0 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft End With End If Next oPara TargetDoc.Paragraphs(1).Range.Style = "Heading 1" End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Macro''''er wrote: Hello, I have several documents in one directory and would like to be able to run a report on these documents to list the document properties such as Category, Title, Last created? Can someone please help if there is a built in tool to accomplish this? Thank you and I look forward to your response. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Retrieve Document Properties in Word
Thank you so much!! I'll try this.
-- Smile...it is good for you! "Graham Mayor" wrote: There's no built-in tool, but it is simple enough to achieve with a macro http://www.gmayor.com/installing_macro.htm : Sub PropertiesReport() Dim strFileName As String Dim strPath As String Dim oDoc As Document Dim TargetDoc As Document Dim proDoc As DocumentProperty Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , _ "List Folder Contents" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" _ Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(strPath, 1) = Chr(34) Then strPath = Mid(strPath, 2, Len(strPath) - 2) End If strFileName = Dir$(strPath & "*.doc") Set TargetDoc = Documents.Add TargetDoc.Range.InsertAfter "Files in folder " & strPath & vbCr While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) With oDoc TargetDoc.Range.InsertAfter .name For Each proDoc _ In ActiveDocument.BuiltInDocumentProperties With TargetDoc.Range .InsertParagraphAfter .InsertAfter proDoc.name & "= " On Error Resume Next .InsertAfter proDoc.Value End With Next TargetDoc.Range.InsertParagraphAfter .Close SaveChanges:=wdSaveChanges End With strFileName = Dir$() Wend For Each oPara In TargetDoc.Paragraphs If InStr(1, oPara.Range, "=") = 0 Then oPara.Range.Style = "Heading 2" Else oPara.Range.Font.Size = 10 With oPara.Range.ParagraphFormat .LeftIndent = CentimetersToPoints(5) .RightIndent = CentimetersToPoints(0) .SpaceBefore = 0 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft End With End If Next oPara TargetDoc.Paragraphs(1).Range.Style = "Heading 1" End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Macro''''er wrote: Hello, I have several documents in one directory and would like to be able to run a report on these documents to list the document properties such as Category, Title, Last created? Can someone please help if there is a built in tool to accomplish this? Thank you and I look forward to your response. . |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Retrieve Document Properties in Word
Hi!
We use the "Author" and "Manager" properties in files for the 2 approvers (should really be "owner" and "approver"). In 2007, the dialogue box is replaced with a new form which doesn't have the manager field or the hyperlink base (haven't compared anything else). Is there a way to jump to the good old dialogue box without having to bother with the new thing, as it is inadequate for my needs. Better still, maybe I should be making my own dialogue box with the Owner and Approver fields. It needs to be something hat is workable on other people's machines too - not specific to mine. Thanks in advance. "Graham Mayor" wrote: There's no built-in tool, but it is simple enough to achieve with a macro http://www.gmayor.com/installing_macro.htm : Sub PropertiesReport() Dim strFileName As String Dim strPath As String Dim oDoc As Document Dim TargetDoc As Document Dim proDoc As DocumentProperty Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , _ "List Folder Contents" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" _ Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(strPath, 1) = Chr(34) Then strPath = Mid(strPath, 2, Len(strPath) - 2) End If strFileName = Dir$(strPath & "*.doc") Set TargetDoc = Documents.Add TargetDoc.Range.InsertAfter "Files in folder " & strPath & vbCr While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) With oDoc TargetDoc.Range.InsertAfter .name For Each proDoc _ In ActiveDocument.BuiltInDocumentProperties With TargetDoc.Range .InsertParagraphAfter .InsertAfter proDoc.name & "= " On Error Resume Next .InsertAfter proDoc.Value End With Next TargetDoc.Range.InsertParagraphAfter .Close SaveChanges:=wdSaveChanges End With strFileName = Dir$() Wend For Each oPara In TargetDoc.Paragraphs If InStr(1, oPara.Range, "=") = 0 Then oPara.Range.Style = "Heading 2" Else oPara.Range.Font.Size = 10 With oPara.Range.ParagraphFormat .LeftIndent = CentimetersToPoints(5) .RightIndent = CentimetersToPoints(0) .SpaceBefore = 0 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft End With End If Next oPara TargetDoc.Paragraphs(1).Range.Style = "Heading 1" End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Macro''''er wrote: Hello, I have several documents in one directory and would like to be able to run a report on these documents to list the document properties such as Category, Title, Last created? Can someone please help if there is a built in tool to accomplish this? Thank you and I look forward to your response. . |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Advanced Document Properties to Standard Properties Window? | Microsoft Word Help | |||
How do I retrieve a word document thats been deleted? | Microsoft Word Help | |||
I need to edit the document properties after properties creation. | Microsoft Word Help | |||
how can i retrieve an unsaved word document | Microsoft Word Help | |||
how do i retrieve my menu bar in a word document | Microsoft Word Help |