I have a macro in Word 2003 that applies the property fields of the open document to all the .doc's in the same folder. The code works once. If I create a folder, create three new documents in that folder, open of the documents and run the macro, it would work. If I open a document in that folder and run the macro again, it would only change the properties of the active document that ran the macro.
The macro is located in a module of the Normal template.
The code:
title = ActiveDocument.BuiltInDocumentProperties("Title")
subject = ActiveDocument.BuiltInDocumentProperties("Subject")
author = ActiveDocument.BuiltInDocumentProperties("Author")
manager = ActiveDocument.BuiltInDocumentProperties("Manager")
company = ActiveDocument.BuiltInDocumentProperties("Company")
category = ActiveDocument.BuiltInDocumentProperties("Category")
keywords = ActiveDocument.BuiltInDocumentProperties("Keywords")
comments = ActiveDocument.BuiltInDocumentProperties("Comments")
fileDirectory = ActiveDocument.Path
vFile = Dir(fileDirectory & "\*.doc")
Do While vFile <> ""
Set wordDoc = Documents.Open(fileDirectory & "\" & vFile)
With wordDoc
.BuiltInDocumentProperties("Title") = title
.BuiltInDocumentProperties("Subject") = subject
.BuiltInDocumentProperties("Author") = author
.BuiltInDocumentProperties("Manager") = manager
.BuiltInDocumentProperties("Company") = company
.BuiltInDocumentProperties("Category") = category
.BuiltInDocumentProperties("Keywords") = keywords
.BuiltInDocumentProperties("Comments") = comments
.Save
.Close
End With
vFile = Dir
Loop
I'm not sure if it has something with the way I'm opening or saving the files. At least if it didn't work at all I would know the code is just wrong, but since it works on a new document at least once... I have no idea.
Thanks in advance.