Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retrieve Document Properties in Word

1 view
Skip to first unread message

Macro''''er

unread,
Nov 13, 2009, 9:17:01 PM11/13/09
to
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! :)

Graham Mayor

unread,
Nov 14, 2009, 2:18:11 AM11/14/09
to
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

unread,
Nov 16, 2009, 12:32:01 PM11/16/09
to
Thank you so much!! I'll try this.

--
Smile...it is good for you! :)


"Graham Mayor" wrote:

> .
>

Bod

unread,
Dec 14, 2009, 4:13:02 PM12/14/09
to
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:

> .
>

0 new messages