Site hosted by Angelfire.com: Build your free website today!
Chapter 5: Copying, Moving, and Sharing Information Between Programs

PreviousChapterContentsGlossaryNext

Sharing Information Using OLE

OLE (Object Linking and Embedding) is far more flexible and can be far more complicated than cut-and-paste or drag-and-drop. OLE enables you to use all your software applications to create an integrated document. For instance, you might want to create an annual report that includes these components:

These components may not reflect exactly what you want to do, but the point is the same--if you want to combine the output of different applications, OLE offers many advantages over the Clipboard. Why? Because, when you use OLE, the original program retains ownership of the object, and you can use the program to edit the object. For instance, if you use OLE to embed a portion of a spreadsheet in a word processing document, you can always use the spreadsheet application to edit the object and the spreadsheet in the word processing document will reflect those changes. If, instead, you use the Clipboard to copy the numbers from the spreadsheet and then you paste the numbers to the word processor, they would just sit in the word processor, oblivious to their origins--you could use only the tools available in the word processor to edit the numbers. This means that if you later change the original spreadsheet, the numbers pasted in the word processing document won't change.

In OLE, an object refers to a piece of information from one application that is placed in a container file created by another application. For example, a spreadsheet or graphic is an object when it is included in a word processing document. OLE actually is two similar methods of sharing information between applications--embedding and linking. Sticking with the previous example, embedding means putting the spreadsheet object in the word processing document (container file) and asking the word processor to take care of storing the object. So, although the word processor enables you to edit the spreadsheet object by using the spreadsheet application, the spreadsheet object is stored with the word processing document. Linking, on the other hand, allows the object to retain a close relationship with its origins--so close, in fact, if the numbers in the original spreadsheet file change, the linked spreadsheet object in the word processing document changes to match. This occurs because the word processing document doesn't really contain the object it displays--it only contains a reference to the file where the information is stored.

You may also choose to insert a package into another file. A package is a small file that uses OLE, but instead of displaying content owned by another application, it displays an icon, which, when clicked, opens the owner application and displays the object. Packages can be either linked or embedded. Whether you choose to embed or link objects, the process is similar: You create an object in one application, and then link or embed the object into another application.

Although using OLE to link files can be wonderfully convenient and can save you hours of revisions, it should be used judiciously. If you ever plan to move the file containing linked objects or to send it to someone, you must make sure one of the following occurs:

Otherwise, your beautifully organized and time-saving document can become a complete mess. If you are going to move a document with linked objects in it, you need to know how to maintain links, a topic covered later in this chapter.

If you don't need the automatic updating you get with linked objects (for instance, if the source file isn't going to change, or if you don't want the object to reflect changes), or if you know you are going to move or send files, then stick with embedded objects--they're easier to maintain. However, embedding a large object may take more disk space than linking.

note Some applications enable you to link one file to another in a different way--by using a hyperlink. A hyperlink actually takes you from one file to another, opening the application for the second file, if necessary.

Creating Linked or Embedded Objects

The way you link or embed an object depends on the application programs you're using--the program into which you want to embed or link the object. Most programs have a menu command to create an object by using OLE, but you may have to use the online help system to find the command. In Microsoft Word, for instance, you can use Insert | Object to create an object by using OLE. When using Insert | Object in Microsoft Word or its equivalent in another program, you may see the Display As Icon option. This option allows you to create a package, an icon that when clicked, opens the object in its native application. The following two techniques may also work to link or embed an object: dragging-and-dropping and using Edit | Paste Special. Neither technique is supported by all applications.

Embedding an Object by Dragging and Dropping

The easiest way to embed an object is to drag the information from one program and drop it in the other program. For this method to work, both applications must support drag-and-drop embedding. Check the documentation for the program that contains the information you want to embed. When dragging the information you want to embed, use the same technique you use to copy selected information within the application: Some applications require you to hold down the CTRL key while dragging the information. For instance, in Excel, you have to click-and-drag the border of the selected area to move or copy it.

Follow these steps to use drag-and-drop embedding:

  1. Select the information you want to embed.
  2. Use drag-and-drop to drag the selected information to the other application; use the same drag-and-drop technique you use to copy information within an application. If the second application isn't visible on the screen, you can drag the information to the application's Taskbar button--hold the mouse pointer there for a second, and the application window opens.
  3. Drop the information where you want it--if the application supports OLE, you automatically create an embedded object.

tip You may be able to specify that the information be linked rather than embedded (the usual default when OLE drag-and-drop is supported) by holding down the SHIFT key--try it to see whether the application you are using supports this feature.

Linking or Embedding an Object Using Paste Special

You may want a little more control over the object than you have when you drag-and-drop it--to achieve more control over the object, use the Edit | Paste Special command found in many applications. The procedure is much like using the Clipboard to cut-and-paste, except you paste by using OLE instead, as follows:

  1. Select the information you want to link or embed.
  2. Press CTRL-C or CTRL-X to copy or cut the information (or use another method to copy or cut).
  3. Move the cursor where you want the object to appear.
  4. Choose Edit | Paste Special. You see a dialog box similar to the one shown in Figure 5-2. Choose the correct application from the choices displayed. Make sure to choose the application you want to use to edit the object--in the figure, that is Microsoft Word. If you choose another option, you won't be using OLE--instead, you will be using the Clipboard to do a simple paste of information from one application to another.
[figure]
Figure 5-2: Use this dialog box (or one like it) to embed a Word document into another file.
  1. Choose the correct setting either to embed the object in the new file or to link the two files together. To embed the object, choose the Paste option; to link the object, choose the Paste Link option. Figure 5-2 shows the settings to embed a Microsoft Word object into an Excel spreadsheet. Figure 5-3 shows the settings to link an Excel spreadsheet into a Microsoft Word document. Other applications may have Paste Special dialog boxes that look different from these.
[figure]
Figure 5-3: Use settings like these to link the object to its parent file.
  1. Change the Display As Icon setting, if necessary. If you choose to display the object as an icon, you don't see the information itself. Instead, you create a packaged object that shows the information it contains only when you open its icon.
  2. Click OK to link or embed the object. You see the object in the container file, as in Figure 5-4.
[figure]
Figure 5-4: Part of an Excel worksheet embedded in a Word document

Editing a Linked or Embedded Object

Editing a linked or embedded object is simple--in most applications, you just double-click the object. For other applications, you may need to right-click the object to display a menu with an edit option or change modes so you are in Edit mode (if you're having trouble, check the help system of the application containing the object). Once you figure out how to edit the object, the object's application opens. Next, the menu and toolbars of the window in which the object appears are replaced by the menu and toolbars of the application assigned by the registry to that file type (usually the application used to create the object). In other words, if you're editing an Excel object in a Word document, double-click the object to display Excel's menu and toolbars in Word's window, as in Figure 5-5. You can edit the object by using that application's tools. When you're done, click outside the object to reinstate the regular menu and toolbars, or choose File | Update or Exit. If you're asked whether you want to update the object, answer Yes.
[figure]
Figure 5-5: Edit an Excel object in a Word document by using the Excel menu and toolbars that appear when you double-click the object.

If the object is linked, rather than embedded, you can also edit the object by editing the source file itself. If the file containing the object is also open, you may have to update it manually to see the new information in the object. Closing and opening the file containing the object may be the easiest way to update the object.

Delete an object by single-clicking it to select it--you'll probably see a box around it--then press the DELETE or BACKSPACE key.

Maintaining OLE Links

If you decide to use a link to put an object in a file, rather than embed the object, you may have to do some maintenance if the linked file or the file containing the link moves to a new location. A link is usually updated each time the file containing the object is opened or printed. Updating means that the current information from the linked file is brought into the object.

If the location of a file changes, you may need to "lock" the link so the last available information is retained, break the link so the object becomes an embedded object rather than a linked object, or edit the link so the correct path and filename are referenced. The exact commands may differ by application (check the online help), but usually there's one dialog box where all these tasks can be performed, like this one:
[image]

In most Microsoft applications, you can display the dialog box by choosing Edit | Links. The following list explains how to do these three tasks in a Microsoft application. Other applications work in a similar way, but may have different names for the dialog box buttons and options.

Another option is to set up the file to update the links only when you tell it to do so by specifying manual updating. The Links dialog box has an Update Method option that enables you to specify automatic or manual updating. If you set this option to manual, the links are updated only when you display the Links dialog box and click the Update Now button.

Saving Small Bits of Data as Scraps

Not everyone finds scraps useful, but if you need them, they may be a lifesaver. Scraps are OLE objects that have been left on the desktop or in a folder. You can keep a scrap on the desktop or in the folder or, at some later point, drag it to another application. A scrap has an icon that looks like this:
[image]

Scrap icons all look the same, but their names give you a clue as to which application created them. For instance, a scrap from Word or another word processor is called a Document scrap, a scrap from Excel is a Worksheet scrap, and a scrap from Quattro Pro is a Notebook scrap (using the Quattro Pro terminology). Not all applications can be used to create scraps. For instance, Notepad, which doesn't support drag-and-drop, cannot be used to create scraps.

To create a scrap, drag some information to the desktop or copy it to the Clipboard, and then paste it to the desktop (by right-clicking the desktop and choosing Paste). When you open a scrap on the desktop, the application that created the information opens to display it. You can drag a scrap into a different application to create an OLE object out of it.

PreviousChapterContentsGlossaryNext