Reading Excel 2004 Cells in Applescript Doesn't Work

R

rocky

The following snipped doesn't return anything. Item_num is undefined.

set C_loc to "R990"
set Item_num to ""
set C_Value to C_loc & "C1"
tell application "Microsoft Excel" to set Item_num to «class pval» of
cell C_Value

I gather with the new addressing scheme I'm should us something like:

set C_loc to "990"
set Item_num to ""
set C_Value to "A" & C_loc
tell application "Microsoft Excel" to set Item_num to «class pval» of
cell C_Value

This gets a missing value.

So R990C1 worked in the old Excel but A990 isn't the equivalent. The
Excel dictionary hasn't been very helpful. Anyone know the secret?

Thanks
 
P

Paul Berkowitz

The following snipped doesn't return anything. Item_num is undefined.

set C_loc to "R990"
set Item_num to ""
set C_Value to C_loc & "C1"
tell application "Microsoft Excel" to set Item_num to «class pval» of
cell C_Value

I gather with the new addressing scheme I'm should us something like:

set C_loc to "990"
set Item_num to ""
set C_Value to "A" & C_loc
tell application "Microsoft Excel" to set Item_num to «class pval» of
cell C_Value

This gets a missing value.

So R990C1 worked in the old Excel but A990 isn't the equivalent. The
Excel dictionary hasn't been very helpful. Anyone know the secret?

Don't use «class pval» . That's the raw code for the old Value property from
Excel X, as it now appears if you open an X script in 2004, which no longer
uses that raw code for anything. Since it doesn't understand the raw code,
it doesn't do anything and you get 'missing value'. In 2004, erase that and
type 'value' instead, and compile. In Excel 2004 that will compile as
'value' using a different raw code (which you don't need to worry about).

Furthermore, Excel 2004 does not use the old "R1C1" type addresses for
cells. It uses "A1" or "$A$1" (the 'absolute reference' version). Therefore
you're going to want "A990" in 2004.

Download the Excel AppleScript Reference from MacTopia
(www.microsoft.com/mac) and go to Resources/Developer/AppleScript.

--
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