Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Calling or running an AppleScript from within a Numbers workbook

I am considering a significant platform change from Windows/Android to straight Apple; I've been poking around to see if I can find the necessary apps for Mac use for my business, and by and large the answer seems to be that this is feasible. The bottom line is that I am fed up with serious problems with Windows running Microsoft Office (major problems with both Outlook and Excel - I'm simply tired of it.)


The most significant stumbling block I currently see is that I use Excel extensively (when it is not crashing) in my daily work habits. I have complex (by some standards) workbooks that utilize several macros each.


For example, when opening a numbered file (say 27442.xlsm), a macro called WorkBookName() pulls the name of the file, removes the extension, and places just the number in a specified cell.


While I see, conceptually at least, how to pull the file number using AppleScript, what I don't see is how to associate that script with any given workbook, so that it automatically calls it when the workbook is created or opened. It seems to me that the script has to be run independently, which is largely self-defeating of the automation I am trying to accomplish.


Can anyone with some expertise give me a little insight on this? I've poked around a number of forums and websites, but don't see quite the answers I am looking for right now.


Thanks

OS X Mavericks (10.9.2)

Posted on Apr 15, 2014 7:19 PM

Reply
Question marked as Best reply

Posted on Apr 15, 2014 7:35 PM

Hello


Unfortunately, AppleScript script is mere external gear for Numbers.app and cannot be integrated with Numbers document in any ways as macro can be with Excel document. Because of the same reason, you cannot create user defined function using AppleScript either.


cf.

I am searching for instructions on creating command buttons.

https://discussions.apple.com/thread/5185043?tstart=0


Regards,

H

5 replies
Question marked as Best reply

Apr 15, 2014 7:35 PM in response to bifjamod

Hello


Unfortunately, AppleScript script is mere external gear for Numbers.app and cannot be integrated with Numbers document in any ways as macro can be with Excel document. Because of the same reason, you cannot create user defined function using AppleScript either.


cf.

I am searching for instructions on creating command buttons.

https://discussions.apple.com/thread/5185043?tstart=0


Regards,

H

Apr 15, 2014 8:05 PM in response to Hiroto

Hiro, thank you. That is the answer I needed, although sadly not the answer I needed!


Can I then safely assume that the same holds true for the Mac version of Excel? This would essentially render me having to use a virtual machine to run Excel in a Windows environment. This is not necessarily out of the question, as I already would have to for a specific Win-only customs app that is at the core of my business.

Apr 15, 2014 9:34 PM in response to bifjamod

what I don't see is how to associate that script with any given workbook, so that it automatically calls it when the workbook is created or opened. It seems to me that the script has to be run independently, which is largely self-defeating of the automation I am trying to accomplish.


You cannot trigger an AppleScript from within a Numbers document. But you can use an Automator workflow to associate a script with a specific Numbers document. Automator workflows can accomplish some pretty sophisticated things without a lot of coding. You might want look into them to see how close they would come to doing what you want to do.


SG

Apr 16, 2014 12:29 AM in response to bifjamod

Hello


I cannot comment on Excel for sure, for I myself don't use Excel. But if I'm not mistaken, Excel for Mac 2011 has VBA macro feature (probably a subset of Windows version). And if necessary, you can even invoke AppleScript from VBA script. So there's some hope.


However, I'd rather recommend you to run Excel for Windows in VM under Mac especially when you're using macro feature extensively and you don't want to waste time in compatibility issues between Mac and Windows versions.


Good luck,

H

Apr 16, 2014 12:13 PM in response to SGIII

SGIII wrote:


what I don't see is how to associate that script with any given workbook, so that it automatically calls it when the workbook is created or opened. It seems to me that the script has to be run independently, which is largely self-defeating of the automation I am trying to accomplish.


You cannot trigger an AppleScript from within a Numbers document. But you can use an Automator workflow to associate a script with a specific Numbers document. Automator workflows can accomplish some pretty sophisticated things without a lot of coding. You might want look into them to see how close they would come to doing what you want to do.


SG

Thanks - I do see some tremendous possibilities with Automator and AppleScript, but the necessity of individual workbooks having embedded script functionality is critical. I've downloaded a 30 day trial of Excel 2011 for Mac and have started playing around with my existing workbooks to see if I can make it work. If so, I might take the plunge - so sick of Microsoft Office crashing on my Win7 machine. As it is, I've stripped so much functionality out of my workbooks trying to resolve the problems, I'm practically back to paper.

Calling or running an AppleScript from within a Numbers workbook

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.