Microsoft Knowledge Base |
|
Excel: Returning Data to AppleScript from Macro |
|
|
Last reviewed: September 12, 1996
Article ID: Q114648 |
|
The information in this article applies to:
SUMMARYWhen you run a Microsoft Excel macro from AppleScript, you can return a result to the script.
MORE INFORMATION
Providing AppleScript with Status Information or the Result from a MacroTo provide AppleScript with status information or the result from a macro, do the following:
Getting Status Information Saved in Cell or Defined NameTo get status information saved in a cell or as a defined name, interrogate the cell or defined name from within the script that called the macro.
Sample MacroThe macro below demonstrates how Microsoft Excel returns a message to AppleScript. The macro creates a window, sizes, and then moves the window around the screen. Upon completion, the macro then sends the message "Macro completed" to AppleScript via the RETURN() function.
Testscript
=NEW(1)
=SET.NAME("window_name",GET.DOCUMENT(1))
=WINDOW.SIZE(200,200,window_name)
=FOR("x",1,30)
= WINDOW.MOVE(x*5,x*5,window_name)
=NEXT()
=FOR("x",31,60)
= WINDOW.MOVE(x*5,300-(x*5),window_name)
=NEXT()
=RETURN("Macro completed.")
NOTE: The RETURN() function MUST return a value. If a value is not
supplied, an error will be generated in AppleScript. If you don't want to
return a value, you can return a null value by using the following function
to terminate the macro:
=RETURN("")
Microsoft provides macro examples for illustration only, without
warranty either expressed or implied, including but not limited
to the implied warranties of merchantability and/or fitness for
a particular purpose. This macro is provided 'as is' and Microsoft
does not guarantee that the following code can be used in all
situations. Microsoft does not support modifications of the code
to suit customer requirements for a particular purpose.
|
|
KBCategory: kbmacro
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |