B
backroomboys
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Once you have merged cells in a table in Word 2008 using Applescript, any further reference to the table's cells in the script produce an error.
As an example, open Word 2008 and run this script:
tell application "Microsoft Word"
make new table at active document with properties {number of rows:4, number of columns:4}
set mytable to table 1 of active document
merge cell (cell 1 of row 1 of mytable) with (cell 1 of row 2 of mytable)
merge cell (cell 1 of row 3 of mytable) with (cell 1 of row 4 of mytable)
end tell
The script inserts a 4x4 table, merges the left hand cells of rows 1 and 2 as it should, then fails with error "Microsoft Word got an error: The object you are trying to access does not exist" number -1728 from cell 1 of row 3 of table 1 of active document.
Any reference to a cell made in an Applescript after merging cells will produce the error. For example substituting "select (cell 3 of row 3 of mytable)" for the last line of the script produces the same error on running the script.
Is this a bug or am I missing something?
As an example, open Word 2008 and run this script:
tell application "Microsoft Word"
make new table at active document with properties {number of rows:4, number of columns:4}
set mytable to table 1 of active document
merge cell (cell 1 of row 1 of mytable) with (cell 1 of row 2 of mytable)
merge cell (cell 1 of row 3 of mytable) with (cell 1 of row 4 of mytable)
end tell
The script inserts a 4x4 table, merges the left hand cells of rows 1 and 2 as it should, then fails with error "Microsoft Word got an error: The object you are trying to access does not exist" number -1728 from cell 1 of row 3 of table 1 of active document.
Any reference to a cell made in an Applescript after merging cells will produce the error. For example substituting "select (cell 3 of row 3 of mytable)" for the last line of the script produces the same error on running the script.
Is this a bug or am I missing something?