Re: Scripting in Word using Styles
Re: Scripting in Word using Styles
- Subject: Re: Scripting in Word using Styles
- From: Allen Watson <email@hidden>
- Date: Wed, 26 Dec 2001 09:31:27 -0800
On Sun, 23 Dec 2001 03:40:56 -0500 Rich Fortnum <email@hidden> wrote:
>
How do you script the following:
>
>
Set myText to "blah blah blah"
>
Set contents of selection to myText
>
Make characters of paragraph 1 with properties {bold, italic, size 18}
>
>
Trying to script multiple entries and have some style to the text. Or, how
>
can I define styles and have them turn on and off? Just don't know the
>
syntax.
>
What follows is a chunk of code from a working script that takes multiple
mail messages from Entourage and creates a Word document with them appended
one after another. It should give you the clues you need:
tell application "Microsoft Word"
if firstMessage then
make new document
set size of paragraph style "Normal" to 10
set font of paragraph style "Normal" to "Courier"
set first line indent of paragraph style "Normal" to 0
copy ("CONSOLIDATED MAIL MESSAGES FROM" & return & "FOLDER: " &
theFolder & ,
return & (current date) as string) & return to end of
document 1
set paragraph style of selection to "Normal"
set contents of selection to theText & divider
set firstMessage to false
else
copy "Folder: " & theFolder & return & theText & divider to end
of document 1
end if
end tell