Microsoft Word Suite
345
Example
This example collapses the selection to its end and then inserts a new paragraph following it.
collapse range text object of selection direction collapse end
type paragraph selection
Command: type text
Inserts the specified text. If the replace selection property of the Word options class is true, the
selection is replaced by the specified text. If the replace selection property is false, the specified text is
inserted before the selection.
Syntax
type text selection object Required. An expression that returns a selection object.
text Unicode text Required. The text to be inserted.
Example
If Typing replaces selection is selected in the Edit pane of the Preferences dialog box, this example
collapses the selection before inserting "Hello." This technique prevents existing document text from
being replaced.
if replace selection of settings is true then
collapse range text object of selection direction collapse start
type text selection text "Hello"
end if
This example inserts "Title" followed by a new paragraph.
set replace selection of settings to false
type text selection text "Title"
type paragraph selection
Command: undo
Undoes the last action or a sequence of actions, which are displayed in the Undo list. Returns true if
the actions were successfully undone.
Syntax
undo document Required. An expression that returns a document object.
[times integer] Optional. The number of actions to be undone.
Example
This example undoes the last two actions taken in Sales.doc.
undo document "Sales.doc" times 2
This example undoes the last action. If the action is successfully undone, a message is displayed in
the status bar.
set u to undo active document
if u is true then set status bar to "Undo was successful"