Can anyone figure out why this doesn’t work? I marked the line where I’m getting the error…
-- App to speak sales figures on excel document with half second delay between figures
try
tell application "Microsoft Excel"
activate
-- loop for mycolumnumns B thru J
repeat with n from "1" to "9"
if n = 1 then set mycolumn to "b"
if n = 2 then set mycolumn to "c"
if n = 3 then set mycolumn to "d"
if n = 4 then set mycolumn to "e"
if n = 5 then set mycolumn to "f"
if n = 6 then set mycolumn to "g"
if n = 7 then set mycolumn to "h"
if n = 8 then set mycolumn to "i"
if n = 9 then set mycolumn to "j"
-- loop for rows 4 to 34
repeat with myrow from 4 to 34
set currentcell to mycolumn & myrow
-- **********Problem at line below**********
copy range range of quoted form of (currentcell) of the active sheet
set thisfigure to the clipboard
say thisfigure
delay 0.5
end repeat
end repeat
end tell
on error
activate application "Script Editor"
beep
display dialog "Damn thing doesn't work!" buttons {"OK"} default button 1
end try
try
tell application "Microsoft Excel"
activate
-- loop for mycolumnumns B thru J
repeat with n from "1" to "9"
if n = 1 then set mycolumn to "b"
if n = 2 then set mycolumn to "c"
if n = 3 then set mycolumn to "d"
if n = 4 then set mycolumn to "e"
if n = 5 then set mycolumn to "f"
if n = 6 then set mycolumn to "g"
if n = 7 then set mycolumn to "h"
if n = 8 then set mycolumn to "i"
if n = 9 then set mycolumn to "j"
-- loop for rows 4 to 34
repeat with myrow from 4 to 34
set currentcell to mycolumn & myrow
set thisfigure to value of cell currentcell
--removed copying value to clipboard. Do you still need it?
say thisfigure
delay 0.5
end repeat
end repeat
end tell
on error
beep
display dialog "Oops!" buttons {"OK"} default button 1
end try