Re: Scripting Excel X
Re: Scripting Excel X
- Subject: Re: Scripting Excel X
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 06 May 2002 09:00:16 -0700
On 5/6/02 8:07 AM, "Eric Phillips" <email@hidden> wrote:
>
I am running OS 10.1.3 with AS 1.7. I wrote a script to have Excel open a file
>
and run an Excel macro using the
>
>
Evaluate "macro name"
>
>
statement. I got this statement by recording the action. The problem is when
>
you run the script the macro does not run.
You need to include the name of the Workbook followed by a "!" followed by
the name of the macro with () after:
Evaluate "Workbook1!Macro Name()"
It's one of the very, very few things in Excel AppleScripting that is
described in the MS Knowledge Base:
<
http://www.microsoft.com/mac/support/mysupport.asp?lu=0>
>
So to fix that I took the time to
>
convert the macro to AppleScript. My problem here is I want to refer to a cell
>
in the form
>
>
select cell(rowcounter, 2)
>
>
The problem of doing this in AS is that I think it is looking at the cell
>
coordinates as an array because it changes the () to {}. To get the cell
>
coordinates into its preferred syntax I need to do the following
>
>
set cellref to "R" $ rowcounter & "C2" as text
>
select cell (cellref)
Yes.
Cell "R4C2"
is the way to refer to a cell, for example. Your code is a little wordy, but
correct. If you just call your variable 'rowcounter' by the letter 'n'
instead, it becomes:
set cellRefto "R" & n & "C2"
Select Cell cellRef
which isn't too bad.
>
>
Am I missing something or do I need to add this extra step every time I need
>
to change my cell reference?
There's possibly a neater way to do it if you supply more sample code.
>
Is there a problem of calling Excel macros from
>
AS?
No, just poor documentation. 'Evaluate' works as above.
--
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.