Changing border colour of cells in tables in MS word

HI fellow scripters,

I have the following problem that I’m trying to solve. I have some InDesign Documents that I need to convert to Microsoft Word. The best way we have found is to just copy and paste the text and all and paste it into word. This keeps the styles and most of the formatting of tables. One of the problem with tables is that if in ID I have a border of NONE, than Word will put instead the default border of black ,75pt, which is not good. So I made a script that basically puts all borders NONE to a 1pt RED in ID, BEFORE, copying to word. And I have another script that makes all borders and columns that are RED in Word to NONE, which should solve my problem. BUT, if I have some merged cells, or different colour set inside the same row or column, the script passes those since there are not all the same RED colour. I have tried to do it by Cells instead of my rows and columns, but it’s so slow, it’s almost as if I was doing this manually. So I’m looking for a better way to do this.

Here’s the script that changes the rows and columns in Word. It will work on all tables in a document. This is another problem I have, the script does this by “selecting” each table and doing the work on each selection at the time. I haven’t found how to do this faster.


tell application "Microsoft Word"
	set myDocument to active document
	set myTables to tables of myDocument
	repeat with i from 1 to (count of myTables)
		set myTable to item i of myTables
		
		select myTable
		
		repeat with j from 1 to (count of rows of selection)
			try
				set myRow to row j of selection
				if color index of (get border myRow which border border bottom) is red then
					set line style of (get border myRow which border border bottom) to None
				end if
				if color index of (get border myRow which border border top) is red then
					set line style of (get border myRow which border border top) to None
				end if
			end try
		end repeat
		repeat with j from 1 to (count of columns of selection)
			try
				set myColumn to column j of selection
				if color index of (get border myColumn which border border left) is red then
					set line style of (get border myColumn which border border left) to None
				end if
				
				if color index of (get border myColumn which border border right) is red then
					set line style of (get border myColumn which border border right) to None
				end if
			end try
			
		end repeat
		
		
	end repeat
	activate
	beep
end tell

Anyway, there isn’t much info on scripting MS word, and microsoft as NO info on MS word 2011, which I’m using. If you know of any site or resources, that would be great!

TIA


tell application "Microsoft Word"
	activate
	set myTables to tables of active document
	
	repeat with i from 1 to (count of myTables)
		set myTable to item i of myTables
		
		tell myTable
			repeat with j from 1 to (count of rows)
				set myRow to row j
				
				tell myRow
					repeat with k from 1 to (count of cells)
						set BO to border options of cell k
						
						tell BO
							if inside color index is red then set inside color index to None
							if outside color index is red then set outside color index to None
							set inside line style to line style none
							set outside line style to line style none
						end tell
					
					end repeat
				end tell
				
			end repeat
		end tell
		
	end repeat
	
	beep
end tell