I have several hundred MS Word documents containing a single table in each. I need to copy the table, paste into Preview and save as jpeg. I can get Word to find the table, but cannot get the "copy object…" command to work. Suggestions welcome!
tell application "Microsoft Word"
activate
tell document 1
count (tables)
-- set firstTable to item 1 of tables — this does not work. Why?
set table_list to tables
set firstTable to item 1 of table_list
tell firstTable
allow page breaks
-- allow page breaks (false) -- syntax error, () not allowed. Why?
set allow page breaks to false -- This does not work either.
allow page breaks
end tell
select firstTable -- this works! Now what?
copy object firstTable --error -1708; doesnt understand "copy object"
end tell
end tell
Best Answer
I simplified the example and was able to find a solution to the invalid "copy object xxx" command syntax. I still don't understand the the actual format for "copy object ..." in Word, but this works!
Script to select the first Table in an MS Word document and copy it to the Clipboard. Can be enhanced to read a folder of documents and process each one. Using list of tables can process multiple tables in a doc.