Copy Letterhead from template to new document in MS Word 2008

I’m trying to create a script that will open a template that has my company’s letterhead, copy the header and footer, then insert the header and footer into the document I’m working on, then, ideally, insert a picture of my signature and print to pdf.

Here’s what I’ve got, that isn’t working. Any ideas?


tell application "Finder"
	activate
	select Finder window 1
	open document file "letterheadtemplate.dotx" of folder "My Templates" of folder "User Templates" of folder "Office" of folder "Microsoft" of folder "Application Support" of folder "Library" of folder "Chip" of folder "Users" of startup disk
end tell
tell application "Microsoft Word" to activate
tell application "System Events"
	tell application process "Microsoft Word"
                keystroke "7" using {command down} --I've defined a system-wide keyboard shortcut for "Header and Footer" to make this work, because I couldn't figure out the command in Word to select the header.
		keystroke "a" using {control down} --I've also done this for select all because I defined a different command for cmd-A
		keystroke "c" using {command down}
	end tell
tell application "Microsoft Word" to activate
tell application "System Events"
	tell application process "Microsoft Word"
		keystroke "`" using {command down} --switch to other window in Word
                keystroke "7" using {command down}
                keystroke "a" using {control down}
		keystroke "v" using {command down}
	end tell
end tell

Hi,

GUI scripting an application with this extraordinary AppleScript dictionary hurts :wink:

You can easily change the contents of the primary header and footer with


tell application "Microsoft Word"
	set s1 to section 1 of active document
	set content of text object of (get header s1 index header footer primary) to "Header text"
	set content of text object of (get footer s1 index header footer primary) to "Footer text"
end tell

For further options read Word 2004 AppleScript Reference p.125

But I need to open the template and copy the graphic letterhead first. It is a graphic.

and…thank you very much for your help! I appreciate it. Can I do what I want?