PDA

View Full Version : AppleScript for copy header from MSoft Word




Avicenna
May 11, 2011, 05:24 PM
Hi,
I am trying to copy header of one file to another exactly, including formatting, page number options etc...How can I do it? I tried this so far, but if I have the page number on the right side in test.docx, it doesn't carry over in newtest.docx.

How can I make it so it copies the formatting too? Here's the code so far:

tell application "Microsoft Word"
activate
open "Macintosh HD:test.docx"
open "Macintosh HD:newtest.docx"
set doc to document "Macintosh HD:test.docx"
set doc2 to document "Macintosh HD:newtest.docx"

set refHeader to content of text object of (get header of section 1 of doc index header footer primary)
set content of text object of (get header of section 1 of doc2 index header footer primary) to refHeader
end tell

Thanks..



jiminaus
May 14, 2011, 06:00 PM
I don't know AppleScript. But have you tried doing this within Word using a VBA macro?