Frage

I am trying to organize the revisions in a Word document. I am obviously missing something pretty basic, as I can't get very far.

The following script

tell application "Microsoft Word"

    set activeDoc to active document

    set revCount to count of revisions of activeDoc

    set aRev to first item of revisions of activeDoc

    set auth to author of aRev
    set when to date value of aRev

end tell

generates the following:

tell application "Microsoft Word"
    get active document
        --> active document
    count every revision of active document
        --> 1275
    get item 1 of every revision of active document
        --> current application
Result:
error "The variable aRev is not defined." number -2753 from "aRev"

The error occurs on the "set auth" reference. I have tried various items in the list with the same result. I also noticed from the dictionary that text ranges can contain revisions, but even with a range spanning the entire document I get zero from a count of revisions from it.

War es hilfreich?

Lösung

Either of the following should fix the immediate problem:

set aRev to first revision of activeDoc

or

set theRevs to the revisions of activeDoc
set aRev to the first item of theRevs

(I thought that the following should work, but right now I have forgotten why not)

set aRev to the first item of (revisions of activeDoc)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top