25.2. Embedding and Linking ObjectsEmbedding and linking are two tools that let you build compound documents , which contain content from two or more applications. Maybe you have a Word file that contains an Excel worksheet. You can save this document as one file and print it as one document, but you need to use both programs to edit its content. Figure 25-1 shows an example.
Embedding and linking are really two different, but related , concepts.
Both embedding and linking generate the same results visually. Which one you use depends on how you plan to update the document. When you embed an object, you create a copy of the data inside the new document. You can edit that data separately, but it's no longer attached to the original source document. When you link a document, any changes you make to the source document automatically appear in the linked document. If you insert a chart inside a Word document, and then modify the chart in your worksheet, then the Word document also gets updated. Note: Overall, embedding is easier to manage, but linking is your best approach if the source data changes frequently and you want to make sure the compound document always has the latest and greatest information. Linking also makes sense if you want to keep several documents synchronized with the same data (you want to do something like show an important worksheet table in four different Word reports ). Embedding usually leads to larger files because more information is placed into one file (the compound document that contains the embedded objects). 25.2.1. Exporting Charts out of ExcelThe best way to understand how linking and embedding work is to try them yourself. Follow these steps to transfer an Excel chart into another Office application like Word:
Note: When you save a document that contains embedded objects, the file itself doesn't look any different. A Word document with an embedded Excel chart retains the standard .docx file extension. In fact, if you look at the file in Windows Explorer, you can't tell that it contains embedded Excel data in addition to its regular Word content. To the untrained eye, there's no way to tell if your pasted chart is a homegrown image (stored as raw picture data) or an embedded object that's owned by a specific program. Either way, it looks like a floating box that you can move around your document as you see fit. You'll notice a difference only if you want to modify your chart. If you've pasted an ordinary picture, you can't change the chart directly. Your only option is to delete the picture, edit the chart in Excel, and then paste in the new one. On the other hand, if you've pasted full-fledged Excel data, you can modify that data to alter the chart (as described in the following sections). Note: There's no reason you can't embed one object inside another, and then take that compound document and embed it as an object inside yet another application. This "Russian doll" approach probably won't accomplish anything except confusing everyone who uses the document, but it's completely possible.
25.2.2. Editing a Linked ObjectIf you've inserted a linked object, you can easily change the linked content. Just open the original file in Excel, and then tweak the numbers . For example, if you pasted a linked chart object into Word, the next time you open the Word document you see the newly modified chart. The best part is that you don't need to do anything to tell Word to update its chart. You can also use the program that has the linked object (in this example, Word), to open the linked object in the appropriate program (in this case, Excel). The exact process for doing this depends on the application that contains the linked object. In many Windows applications, you need to right-click the linked object, and then choose Linked Worksheet Object Edit Link (or just double-click the object). This action pops up a new Excel window with the corresponding workbook. However, Word is a bit smarter . As soon as you select a linked chart, it adds the familiar Chart Tools tabs to its own toolbar (Figure 25-4, circled). If you want to see or change the Excel data in the original workbook file, right-click the chart, and then choose Edit Data.
Sometimes, when you change the worksheet data, the changes don't appear in the linked object right away. To trigger a refresh right away in a non-Office application, right-click the chart, and then look for an Update Link command. Or, in an Office application like Word, select the chart, and then choose Chart Tools Design Data Refresh Data. If you cant do either of these things (for example, you're in a non-Office application that doesn't have the Update Link command), just close the document that contains the linked object, and then open it up again to force it to get the latest data. Tip: Linking works particularly well if you want to insert only a small part of a much larger workbook. Linking doesn't increase the size of the target document because it stores only a link to the worksheet containing the data you're using. 25.2.3. Editing an Embedded ObjectWorking with an embedded object is sometimes a bit trickier because the Excel object is actually stored inside the other file (for example, inside a .docx Word document). As a result, you can't just open the workbook directly in Excel. Instead, you need to open the host program (like Word), and then tell it to fire up Excel for you. Different programs vary in how they work with embedded objects. If you've transferred an object from Excel and embedded it in another Office application using Ctrl+V (the ordinary Paste command), you'll get the same nifty integration you saw in Figure 25-4. Just select the chart and use the Chart Tools tabs to perform some basic tweaking, or right-click your chart and choose Edit Data to pop open an Excel window that shows you the original workbook in the exact state it was when you performed the copy. When you edit this workbook, it seems like you're editing a standalone workbook file. However, in reality, your data is coming from another file in another program (like a Word document or a PowerPoint presentation). If you've embedded a chart in a non-Office program, you're in for a bit more work. Usually, you need to right-click the object and then choose a command like Worksheet Object Open to launch Excel. When the new Excel window appears, youll notice that your workbook doesn't look exactly the same as you left it (Figure 25-5). That's because when you paste an embedded chart to a non-Office program, Excel moves the chart to a separate worksheet, and displays only that worksheet in the document. To change your data, you need to find the worksheet where the chart's data resides. This task isn't too difficult because an embedded chart object actually contains your complete workbook. You can switch from one worksheet to another using the familiar worksheet tabs. (Here, the original chart data is in Sheet1.)
When you're finished making your changes, choose Office button Close and Return to close the "virtual workbook and automatically insert the new data back into your compound document. Note: Embedded data is always stored in the document where it's embedded. In the previous example, there are two separate copies of the workbook. One is stored in a workbook file, and the other is embedded in the Word document. It's important to realize that these two documents are completely separate. If you modify one, it doesn't affect the other. In fact, you can even delete the original workbook file and still use the embedded one.
25.2.4. Importing Objects into ExcelYou can use the same process described in the previous section to copy objects out of other programs and place them inside Excel. In Excel, embedded objects appear as floating boxes (like pictures and charts). You can position these floating boxes wherever you want on your worksheet. Embedding doesn't make sense for all types of objects. Although technically you can paste a bunch of text from a Word document as a floating object in a box, it doesn't integrate all that naturally into an Excel worksheet. However, other types of objects may make more sense. One example is an image format that Excel doesn't support. You could paste this image as an embedded object by copying it from the appropriate drawing program. The trick is Excel's Home Clipboard Paste Paste Special command, which works just like it does in all other Office applications, including Word. Figure 25-6 shows an example of an object that's been transferred from Visio, a program that helps create diagrams.
|