Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Working with Word Document Properties



In regard to deletion of custom document properties in Word AppleScript, it appears that you've found a bug. You can work around this with the 'do Visual Basic' event:

tell application "Microsoft Word"
    set vbCode to "ActiveDocument.CustomDocumentProperties(\"foo\").Delete"
    do Visual Basic vbCode
end tell

I logged the 'delete' bug against Word AppleScript.

In regard to modifying values of built-in document properties, some of these are read-only. The ones you mention are among them. I think that the set of read-only document properties is documented anywhere. However, you can glean some information from the Properties dialog. If a property is in the Summary section, it's writable. If it's in the Statistics section, it's read-only.

The only programmatic way to tell that a property is read-only is to attempt to modify its value and read it back to see if the change stuck. You won't ever get an error trying to write to a read-only document property. (You get the same behavior from VB.)

-----Original Message-----

Date: Thu, 31 May 2007 23:26:42 -0700
From: David Glass <email@hidden>
Subject: Working with Word Document Properties
To: AppleScript Users <email@hidden>
Message-ID:
        <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I'm trying to write a script that will strip as much of the metadata
out of a Word document as possible, and have run into a couple of snags.

1. Even though the Word (2004) dictionary shows 'get/set/delete' for
'custom document property' I am unable to actually delete any.  I
receive an error that the custom document property doesn't understand
the delete message.  Has anybody gotten this to work?

2. I can't seem to effect a change in the Revision number, Total time
edited, and a couple of other standard document properties.  I don't
get an error when I try to modify their values, but the values don't
change.  Any thoughts on if this is the proper behavior?

Thanks for any guidance.

--
David Glass - Gray Matter Computing

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.