I have a script that duplicates tables in a Word document, but it’s very slow. I just tried, and I was doing 215 tables, and after 10 minutes it only had done 87 tables.
There is not much difference between Word 2019 (current) and Word 2011. Also switching off all Sharing options (in the hope it did something with remote Apple Events) didn’t speed up stuff. I noticed Word was using a lot of CPU.
It seems the time it takes increases exponentially (or at least not linear). In the first minute it duplicated around 35 tables, and it becomes slower with time.
The code:
using terms from application "Microsoft Word"
tell document report_name
--tablenr: the table to duplicate
--nr_needed: how many copies we need
set my progress description to "Duplicate foto-tables"
set table_list to tables -- all tables from document
set tables_needed to tablenr + nr_needed - 1
set table_counter to tablenr
repeat while table_counter < tables_needed
duplicate item tablenr of table_list
set table_counter to table_counter + 1
set progress completed steps to progress completed steps + 1
end repeat
end tell
end using
Is there another way to duplicates this table? Any idea’s?