The title says it all: anyone got any insight into how to set a keyword and/or category and/or comments in the “Properties/Summary Tab” of an MS Word document?
Hi there,
Having looked through the dictionary I can’t see anything to set this info. I’m sure someone will correct me if i wrong
I did a little trawling on the web and came up with some VBA that allows you to set this info.
So, I created the Macro below in MS Word and gave it the name SetSummaryInfo2.
[format]
Sub SetSummaryInfo2()
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = “xxx Title xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertySubject) = “xxx Subject xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor) = “xxx Author xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyManager) = “xxx Manager xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyCompany) = “xxx Company xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyCategory) = “xxx Category xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyKeywords) = “xxx Keywords xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyComments) = “xxx Comments xxx”
ActiveDocument.BuiltInDocumentProperties(wdPropertyHyperlinkBase) = “xxx Hyperlink Base xxx”
End Sub
[/format]
I then called the Macro using the AS code below:
tell application "Microsoft Word"
run VB macro macro name "SetSummaryInfo2"
end tell
That worked for me.
HTH
Needed to do this myself, so did some research, and looked through the “word-2004-applescript-reference” doc.
Not necessary to do it in VBA as it’s trivially simple in AS.
set keywords to "uno, dos, tres"
set value of document property "Keywords" to keywords
You can set any of the other doc properties this way.
To return a list of all properties and their values, or get specific property value:
set docProps to document properties
set kw to document property "Keywords"
Correction to code for getting document property.
It should be:
set kw to value of document property "Keywords"