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 :
Text you create and format by using a word processor, such as Microsoft Word or Corel WordPerfect
A company logo stored in a graphics file created by Adobe Photoshop, Paint, or some other graphics application
Data and calculations on operating costs stored in a Microsoft Excel spreadsheet
Graphs and charts , which may come from your spreadsheet package or another graphics package
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 plan ever to move the file containing linked objects or to send it to someone, you must make sure one of the following occurs:
The linked files also get moved or sent.
The linked objects don't get updated. This means the host application won't go looking for the information in the linked file. To break the link, delete the object and paste in a nonlinked version instead.
You edit the links so the host file knows where to find the source files for the linked objects.
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 (see "What Is the World Wide Web?" in Chapter 26). A hyperlink actually takes you from one file to another, opening the application for the second file, if necessary. |
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 Home Paste Paste Special to create an object by using OLE. When using Home Paste Paste Special in Microsoft Word or its equivalent in another program (usually Edit Paste Special), 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 Home Paste Paste Special. Neither technique is supported by all applications.
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:
Select the information you want to embed.
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.
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. |
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 Home Paste 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 :
Select the information you want to link or embed.
Press CTRL-C or CTRL-X to copy or cut the information (or use another method to copy or cut).
Move the cursor where you want the object to appear.
Choose Home Paste Paste Special. You see a dialog box similar to the one shown in Figure 5-1. 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 Office Excel. 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.
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-1 shows the settings to embed a Microsoft Excel object into a Word document.
Figure 5-1: Use this dialog box (or one like it) to embed an Excel document into another file.
Change the Display As Icon check box 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.
Click OK to link or embed the object. You see the object in the container file, as in Figure 5-2.
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 shown in Figure 5-3. 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 in some applications. If you're asked whether you want to update the object, answer Yes.
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.
To delete an object, click it to select it-you'll probably see a box around it-and then press the DELETE or BACKSPACE key.