Using the Word Dictionary
A better way to create a new document is to assign the return value to an object variable. The make
command returns a document object that refers to the new document. In the following example, the
document object returned by the make command is assigned to an object variable,
several properties and commands of the document object are set. You can easily control the new
document using the
set newDoc to make new document
set name of font object of text object of newDoc to "Arial"
save as newDoc file name "Sample.doc"
Opening a document
To open an existing document, use the open command. The following instruction opens a document
named "MyDocument.doc" located in the folder named "Shared."
open "Macintosh HD:Users:Shared:MyDocument.doc"
Saving an existing document
To save a single document, use the save command. The following instruction saves the document
save document "Sales.doc"
You can save all open documents by applying the save command to the documents list. The
following instruction saves all open documents.
Saving a new document
To save a new document, use the save as command. The following instruction saves the active
document as "Temp.doc" in the current folder.
save as active document file name "Temp.doc"
The file name argument can include only the file name or the complete path.
To close a single document, use the close command. The following instruction closes and saves the
document named Sales.doc.
close document "Sales.doc" saving yes
You can close all open documents by applying the close method to the documents list. The
following instruction closes all documents without saving changes.
close documents saving no
Activating a document
To change the active document, use the activate object command. The following instruction
activates the open document named "MyDocument.doc".
activate object document "MyDocument.doc"
The activate object command command only works if Word is the frontmost application. Use the
activate command to ensure that Word is at the forefront.