Hello,
I found a script here that purportedly worked in Word 2004, but it does not seem to work in Word v. X. I was wondering if anyone had any idea why. The idea was to create a script that joined multiple RTF files together into one file.
tell application “Microsoft Word”
set the_folder to choose folder “Choose your folder of RTF files”
set the_files to (my get_folder_list(the_folder, “rtf”))
set combineDoc to make new document
repeat with rtffile in the_files
open rtffile
set curDoc to the active document
select the text object of curDoc
copy object selection
close curDoc saving no
collapse range text object of combineDoc direction collapse end
paste object selection
end repeat
end tell
on get_folder_list(the_folder, file_extension)
set the_files to {}
tell application “Finder” to set folder_list to every file of folder the_folder whose name ends with file_extension
repeat with new_file in folder_list
copy (new_file as string) to end of the_files
end repeat
return the_files
end get_folder_list
When I try to save or run it, it highlights “document” after the word “active” (on line 7), and gives an error that says “expected and end of line, etc but found class name.” I have looked at the Word v. X dictionary, but do not see anything there that might preclude this from working. Any help is greatly appreciated.