Reading document properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code that looks like this:

Set AppName = CreateObject("Word.Application")
AppName.Visible = True
AppName.ChangeFileOpenDirectory "C:\New Folder\"
AppName.Documents.Open filename:=strTitle, _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto

MsgBox (AppName.Documents.Item(strTitle).Name)
MsgBox (AppName.Documents.Item
_(strTitle).BuitInDocumentProperties(wdPropertyWords))


The first message box correctly returns the name of the document opened
remotely.

The second MsgBox fails with a message that says the object does not support
this property.

I'm trying to read in the document properties of a large selection of files
so that I can sort them by author and date etc.

It seems to me that this should work, any ideas what the problem is?
 
Have you set a reference to the Microsoft Word object library? If not,
wdPropertyWords won't be recognised. Either set the reference or replace
wdPropertyWords with its value (15).
 
The reference is set and when I roll the cursor over wdPropertyWords the
value 15 shows in the window.
 
Back
Top