Downloads
43026.zip

Q: Can I work on Microsoft Word documents if the software isn't installed on my machine?

A: Conventional wisdom suggests that you need to have Word installed on your computer if you expect your computer to use it. However, this wisdom isn't necessarily true.

Most modern programs use COM to expose software functionality. COM is useful for automation because an application can interact with the program's features by means of COM objects. For example, you can use COM objects to embed a Microsoft Excel spreadsheet in a Word document. A script can also interact with COM objects as long as they're designed for scripts. (The COM object must implement the IDispatch interface.)

For a script to interact with COM objects from an application (such as Word), the application must be installed on the machine. However, there's a version of COM called Distributed COM (DCOM) that enables a script to interact with COM objects from applications on remote machines. For example, on a Web server, you might run a script that uses DCOM to create Excel graphs with an Excel application that's installed on another computer in your network. Therefore, you don't need to have software installed on your machine to use it.

Listing 2 shows how to use COM to create a Word document. Listing 3 uses DCOM to create the same document. As you can see, the only real difference between using COM and DCOM is that when you use DCOM to create the $WordApp object, you must specify the name (or IP address) of the machine on which the Word application is installed.

Although DCOM lets users run applications that aren't installed on their machines, this practice can be dangerous. Users can wreak havoc on your network by forcing other machines to load Word, Excel, Adobe Systems' Adobe Photoshop, and a host of other applications on their behalf. However, you can use the dcomcnfg.exe tool, which comes with Windows, to limit who can remotely interact with applications on machines. This tool lets you configure DCOM interfaces and list the users who can run, interact, and modify machines' applications. You also use dcomcnfg.exe to configure whether the data being sent over the network is encrypted.