Applescript and range - bug?

T

Tom

Hoping someone could confirm a bug and/or workaround...

I have a set of scripts that worked in Excel X and Excel 2001 and no
longer works in Excel 2004. Here's a simple sample...


tell application "Microsoft Excel"
activate worksheet 1
set testing to value of range "R11C2"
end tell

This would returrn contents in row 11 column 2. Doesn't appear to
work in Excel 2004.

Can anyone confirm that there's a problem in within Excel.
 
K

Kristina Conceicao

Tom said:
Hoping someone could confirm a bug and/or workaround...

I have a set of scripts that worked in Excel X and Excel 2001 and no
longer works in Excel 2004. Here's a simple sample...


tell application "Microsoft Excel"
activate worksheet 1
set testing to value of range "R11C2"
end tell

This would returrn contents in row 11 column 2. Doesn't appear to
work in Excel 2004.

Can anyone confirm that there's a problem in within Excel.

Hi Tom,

The Dictionary of commands that AppleScript can use to "control" Office
was changed quite a bit for Office 2004. You can open the dictionary
from AppleScript via the File menu to browse the commands. I'm not sure
if the "activate worksheet" command has changed, but I do know that the
command to reference a range has changed. You can use the following in
place of your third line:

set testing to value of cell "B11"

The "R1C1" type cell reference that you were using might still work, but
I haven't tried it myself.

Hope this helps!

Kristina
 
P

Paul Berkowitz

The Dictionary of commands that AppleScript can use to "control" Office
was changed quite a bit for Office 2004. You can open the dictionary
from AppleScript via the File menu to browse the commands. I'm not sure
if the "activate worksheet" command has changed, but I do know that the
command to reference a range has changed. You can use the following in
place of your third line:

set testing to value of cell "B11"

The "R1C1" type cell reference that you were using might still work, but
I haven't tried it myself.

No. The R1C1 type address no longer works. (There were terrible bugs with
that system which made localized, non-English versions of Excel
unscriptable.) The best format to use is the "absolute" reference style
"$A$1". ("A1" may be relative to its range.)

If you don't know this address for a particular cell, you can get it via
'get address':

get address of cell 1 of used range
--> "$A$1"

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top