MXL: Using AppleScript with Microsoft Excel

ID: Q113891

The information in this article applies to:

SUMMARY

Microsoft Excel versions 4.0 and later support AppleScript in the scriptable capacity. This allows Microsoft Excel to be controlled from other programs or scripts.

MORE INFORMATION

Apple Computer, Inc., has defined an English-like batch file processing system for the Macintosh line of personal computers. This system is similar in power and flexibility to UNIX shell scripting, but is much easier to use.

Microsoft Excel versions 4.0 and later supply the "aete" resource and the necessary Apple Event capability to fulfill the scriptable level of AppleScript support. To use the application-specific capabilities of Microsoft Excel with AppleScript, open and examine the AppleScript dictionary supplied with Microsoft Excel.

To open the dictionary in Microsoft Excel by using the Script Editor, follow these steps:

1. Start the Script Editor.

2. On the File Menu, click Open Dictionary.

3. In the dialog box that appears, open the folder that contains the

   Microsoft Excel program.

4. Select the Microsoft Excel program and click Open.

The window that appears allows you to select an object or a class to view its description. You can also click the bold suite names to view an entire suite at one time. The descriptions in this window can be used to create scripts within the Script Editor to control Microsoft Excel.

The following is a list of Apple Events supported by Microsoft Excel for the Macintosh.

Microsoft Excel Version 5.0 and Microsoft Excel 98 Macintosh Edition

These versions of Microsoft Excel support a very large number of events. For a complete listing, follow the instructions in this article to open Microsoft Excel in the AppleScript Script Editor.

Microsoft Excel Version 4.0

Core suite:

   Clone              Do Objects Exist   Print
   Close              GetData            Quit
   Count Elements     Get Data Size      Save
   Create Element     Move               SetData
   Delete             Open

Miscellaneous Standards suite:
   Begin Transaction  Do Script          Redo
   Copy               End Transaction    Revert
   Create Publisher   Paste              Undo
   Cut

Table suite:
   The table suite does not define any Apple Events, but it defines
   some objects. Microsoft Excel supports and extends the definition
   of these objects.

Custom Apple Events:
   DoMacro
   Recalc

Microsoft Excel Version 3.0

   Open Application
   Open Documents
   Print Documents
   Quit Application

REFERENCES

"Inside Macintosh Inter-application Communication", Chapters 4, 7-10 "AppleScript Software Developers Kit" "Microsoft Excel SDK", version 4.0, pages 148-149

Additional query words: 4.00 4.00a 5.00 5.00a 98 programming Apple script code

Keywords          : kb3rdparty kbenv
Version           : MACINTOSH:4.0,4.0a,5.0,5.0a,98
Platform          : MACINTOSH
Issue type        : kbinfo

Last Reviewed: September 4, 1998