Re: Excel 2004 question
Re: Excel 2004 question
- Subject: Re: Excel 2004 question
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 17 Jul 2004 13:32:16 -0700
On 7/17/04 12:09 PM, "Christopher Stone" <email@hidden> wrote:
>
I can't seem to extract the cell address of a and b in a sensible fashion.
>
>
tell application "Microsoft Excel"
>
tell sheet 1
>
set a to first cell of used range
>
set b to last cell of used range
>
end tell
>
end tell
>
>
a = range "$A$1" of used range of sheet 1
>
b = range "$K$50" of used range of sheet 1
>
>
Is there a better way than:
>
>
tell application "Microsoft Excel"
>
tell sheet 1
>
set a to <<class seld>> of (first cell of used range as record)
>
set b to <<class seld>> of (last cell of used range as record)
>
end tell
>
end tell
>
>
a = "$A$1"
>
b = "$K$50"
tell application "Microsoft Excel"
tell active sheet
set a to first cell of used range
set b to last cell of used range
{get address a, get address b}
end tell
end tell
--> {"$A$1", "$BV$5"}
'get address' [including the 'get'] is in the Table Suite, with optional
parameters for relative vs. absolute, R1C1 reference style, etc. There are
quite a few commands like this, in all suites, that "look like" 'get' plus
an object but are actually a command 'get something'. It's not orthodox
AppleScript, but often the OLE Object Model which the AS accesses doesn't
have objects or properties such as 'address'. In Excel X/2001/98(which also
had lots of proprietary commands) many of these - such as this one - weren't
available, while in 2004 they are. The power and versatility of the new
dictionary seem to make it worthwhile, even though it doesn't always follow
best AS syntax. MS felt that they couldn't maintain two different models, so
they are mirroring the VBA model in a parallel fashion, but with lots of AS
adaptations, such as plurals as list, whose clauses, etc.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.