I had all these nifty scripts for Excel previous to version 2004 and they worked fine, now all my cell references are broken and I cannot seem to get Excel to understand them. While not the most elegant, the script below worked perfectly.
tell application “Microsoft Excel”
set rowcount to 1
set columncount to 1
set cellcounter to 1
set emailcell to 1
set email to “empty”
Insert Column “A”
repeat while (cellcounter) ? “” --repeat as long as the next cell is not empty
set email to FormulaR1C1 of Range (“R” & (rowcount as string) & “C13”) --collect the email address to copy
if (email) = “” then
set email to “no email address”
end if
set rangevariable to (“R” & (rowcount as string) & “C” & (columncount)) – creates “rangevariable”, stores the cell coordinates
Select Range rangevariable – selects the cell to operate on
set FormulaR1C1 of ActiveCell to email – stores the data into active cell
set rowcount to rowcount + 1 --increments loopcount
set cellcounter to FormulaR1C1 of Range ((“R” & (rowcount as string) & “C2”) as string) – sets “cellcounter” to the value of cell in row below
end repeat
end tell
Now, when I have Excel 2004 installed, the text is recompiled and none of the range or cell text is correct - it looks like this:
tell application “Microsoft Excel”
set rowcount to 1
set columncount to 1
set cellcounter to 1
set emailcell to 1
set email to “empty”
«event XCELINSR» column “A”
repeat while (cellcounter) ? “” --repeat as long as the next cell is not empty
set email to «class PFO1» of «class crng» (“R” & (rowcount as string) & “C13”) --collect the email address to copy
if (email) = “” then
set email to “no email address”
end if
set rangevariable to (“R” & (rowcount as string) & “C” & (columncount)) – creates “rangevariable”, stores the cell coordinates
«event XCELSLCT» «class crng» rangevariable – selects the cell to operate on
set «class PFO1» of «class PACL» to email – stores the data into active cell
set rowcount to rowcount + 1 --increments loopcount
set cellcounter to «class PFO1» of «class crng» ((“R” & (rowcount as string) & “C2”) as string) – sets “cellcounter” to the value of cell in row below
end repeat
end tell
Any ideas on how to correct the range and cell identification text to that Excel 2004 understands?