You may freely copy, distribute, and reuse the code in this example. NeXT disclaims any warranty of any kind, expressed or implied, as to its fitness for any particular use.
This example is a Microsoft Excel spreadsheet which illustrates "Distributed OLE Automation", or OLE Automation objects communicating across a network via the NeXT ORB. The spreadsheet downloads a range of cells connects to Microsoft Word on a user-specified machine, and formats them into a table.
Running the example
* Make sure the NeXT ORB is up and running on the remote machine. You don't need to start Word: the ORB should take care of this for you.
* To start the example, click on the button labelled "Run example..." on the worksheet entitled "MainSheet". (This button is bound to the Auto_Open macro, so that the example is run whenever the workbook is opened).
* A panel allowing you to configure the connection to Microsoft Word should appear. If you choose the Use NeXT ORB option, you can specify a host name (leave this field blank if you want to use the local host). The Use OLE Registry Entry allows you to bypass the ORB and connect directly to Word on the local host. Alternatively, if you've used the orbreg tool to create an entry in the registration database for Word on a remote machine, you may use this entry.
* Excel will now attempt to connect to Word in the manner specified. If a connection is successfully made, the Employees information on the main sheet should be downloaded line-by line. Word should then format its contents into a table, and resize the columns one by one.
* Excel displays an alert panel saying "Done!" when it's finished. If Word was started by the NeXT ORB, it should quit automatically.
Worksheets in the example
MainSheet
Contains the cells (derived from the EOF People database) to be sent to Word.
Word
Contains the code which talks to Word. Most of the work is done by writeEmployeesToWord, while getServer gets hold of the Word application object.
Employees
Some setup code related to MainSheet.
SetupCode
This is the Visual Basic code used to configure the setup dialog box.