Re: AppleScript and Microsoft Excel
Re: AppleScript and Microsoft Excel
- Subject: Re: AppleScript and Microsoft Excel
- From: David Wignall <email@hidden>
- Date: Sat, 31 Aug 2002 13:28:55 +1200
On 8/30/02 7:36 AM, "Doug McNutt" <email@hidden> wrote:
>
It's fairly easy to set up a macro in Visual Basic for Applications (VBA)
>
that
>
will run only as a workbook is opened. Look for Workbook_Open in the VBA
>
help
>
files. But, after saying that, I don't know how to ask VBA to call an
>
AppleScript. VBA can display a "form" requesting information and of course
>
it
>
can populate cells.
Couple of things. You would have to design the form and write the code for
the controls. Not difficult if you already know how :-P Other and more minor
point is that the Workbook_Open event procedure should exit if the data
already exists, otherwise it will run every time.
on 31/8/2002 03:24 AM, Paul Berkowitz at email@hidden wrote:
>
The 'Macscript' command in VBA can call any AppleScript, either by filepath
>
- if it's an applet - or simply embedding an actual script. The latter
>
method can get a bit complicated since you need to do two things: every line
>
ending needs to be " & VbCr & " ( or & Chr(13) & ) . To make it look more a
>
normal script on separate line, that would be
>
>
"A line of script here" & VbCr & _
>
"Another line here" & VbCr & _
>
>
etc. You get used to it. Then literal quotes get complicated, since you need
>
not only AS's back-slash escape, but VBA's doubling of every quote:
>
>
"an internal \""quote\"" here"
>
>
Using variables in the middle of these things can get really mind-boggling
>
working out the quoting. I've had 5 at a time """""".
Stupid things I have done: declare constants of various length
concatenations of Chr(34), write a function to create various length
concatenations of Chr(34) and declare constants that are standard
AppleScript terms, including escapes.
Easiest IMHO, if it's appropriate, is to type the script into a cell
beforehand and pick it up with Range(whatever).Text
--
fwiw
Dave
_______________________________________________
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.