The information in this article applies to:
SUMMARYThis article contains an AppleScript example that demonstrates the use of the following WordBasic statement and function: MacScriptThis article supplements the information in online Help. To open this Help topic, choose the Help button on your keyboard, select the Programming With Microsoft Word option, and type macscript on the query line. WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. MORE INFORMATIONSyntax
Script$ is the path and filename of a script or a text string that will
be compiled and run by AppleScript.
The MacScript statement runs an existing AppleScript script or passes a text string to AppleScript that will be interpreted by AppleScript. The MacScript$() function behaves the same as the MacScript statement and also returns the value returned by Script$. The MacScript$() function always return a string. If the script specified by Script$ returns anything other than a string, it is converted to a string by MacScript$(). If the script specified by Script$ does not return a value, the MacScript$() returns the empty string(""). In Windows, the MacScript statement and MacScript$() function are not available and generate errors. ExampleThe following macro refers to a script called CalculateString. Suppose that this script takes the selected string in a Word document and sends it to Microsoft Excel, where Microsoft Excel tries to evaluate the string as a formula. If Microsoft Excel can evaluate the formula, the script returns the value to Word as a string. The WordBasic macro can then replace the selection with the contents of result$.
REFERENCES"Microsoft Word Developer's Kit," version 6.0, Microsoft Press, 1994, Appendix D, "AppleScript" Additional query words: word basic
Keywords : kbmacro kbmacroexample macword word6 |
Last Reviewed: December 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |