Hi,
this is perhaps not the right forum to put a Excel2008-question. But …
In Excel one can assign an AppleScript to the onAction property of a button. Is it possible to start this AppleScript, if the user clicks on that button?
If this is the case: which path has to be used, that Excel finds and starts this AppleScript?
Thanks
I’m not familiar with 2008 (still using 2004). I’m surprised that buttons would a) be avaliable in 2008 and b) would have an OnAction property, since there’s no VBA in 2008.
Having said that, a typical file path for use by Excel would look something like
“Macintosh HD:Users:merickson:Desktop:ScriptsStuff:AddBook.scpt”
One spreadsheet application that supports buttons and features an unrivaled AppleScript dictionary is RagTime:
Buttons in RagTime (Screenshot)
But it’s not cheap…
the onAction is documented. But I’m not shure wether it is a relict of 2004 and non functional. The onAction property accepts no “:” and no ""
This path does not work in 2008
I’m guessing it’s a relic.
What does 2008 Help say about buttons, what does 2008 think they are for?
It seems to me that, absent VBA or a patch to AppleScripts, a command button is just a rounded rectangle.
You could call your scripts from the script icon on OS 10’s menu bar.
I’m affraid too.
I think the same.
Yes, but the pitty is, that the menu’s are not specific to the active spreadsheet. They are allways shown. If the customer uses an other sheet, s/he allway sees our menu’s
I’m envisioning a monster of a set-up where the scripts
a) poll which sheet is active before branching to the proper actions.
b) a script (running in the background) that does something like
[code]–pseudo script
repeat while frontmost of application “Microsoft Excel”
If name of active sheet = “Sheet 1” then
–rename the .scpt file to “sheet1 script”
Else if
–rename the .scpt file to “sheet2 script”
End If
end repeat[/code]
Are none of your clients on a PC?
If you need help getting native Excel to do your bidding, PM me.
(to MACSRIPTER: What is this board’s policy about posting links to other (non-Apple Script) help sites?)
Actualy, I came up with this. After running this script, pressing Button 2 will call the Applescript saved in Untitled2.scpt.
tell application "Microsoft Excel"
set actionString to "run script \"Macintosh HD:Users:merickson:Desktop:Untitled 2.scpt\" as alias"
set shape on action of shape "Button 2" of active sheet to actionString
end tell
However, this has to be called every time that the workbook is opened.
There probably is a way to run the posted script automaticaly when a specified workbook is opened, but I don’t know what that way would be.