Microsoft KB Archive/235658

= WD2000: How Word Inserts an Excel Workbook by Using Drag-and-Drop Operation =

Article ID: 235658

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q235658



SUMMARY
When you drag a Microsoft Excel 2000 file into Microsoft Word 2000, you may experience different behavior depending on how you drop the file in.

Case 1
If you do not have a Word document open when you drop the Excel file, Word displays the Open Worksheet dialog box. You can open the entire workbook or a sheet in the workbook. When you click OK, the workbook or worksheet information is displayed in a Word table in a new blank Word document. It is not inserted as a field.

Case 2
If you have a Word document open when you drop the Excel file, Word inserts the Excel file as an embedded object. You can double-click this object and update the contents of the Excel file by using in-place editing.

To check whether your Excel file is embedded in your Word document, press ALT+F9. You should see a field code similar to the following:

{EMBED Excel.Sheet.8}

NOTE: Press ALT+F9 to turn the field code off and display the results of your embedded Excel worksheet.



MORE INFORMATION
By default, Word 2000 inserts Excel files as objects rather than tables when you have a document open. The object displays a preview of the workbook. You can resize the object to display more of the data by double-clicking it and then dragging a sizing handle.

Do one of the following appropriate for your situation:  If you want to insert the Excel worksheet as a table into an existing Word document, follow these steps:  On the Insert menu, click File. Select the Excel file you want and click Open.

-or-

 If you want to display the Excel worksheet as an icon, follow these steps:  On the Insert menu, click Object. Click the Create from File tab.</li> Click to select the Display as icon check box.</li> Click Browse, select your file, and then click Insert.</li> Click OK.</li></ol>

-or-

</li> If you want to convert an embedded object and have it be displayed as an icon, follow these steps:  Click to select the object.</li> On the Edit menu, point to Worksheet Object and then click Convert.</li> Click to select the Display as icon check box.</li> Click OK.</li></ol>

-or-

</li>  You can also use a Microsoft Visual Basic for Applications macro to convert the worksheet object to an icon.Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following example macro demonstrates this:

NOTE: Make sure you select the object before running this macro. Sub ConvertObject If Selection.Type = wdSelectionShape Then Selection.ShapeRange(1).ConvertToInlineShape.Select End If   Selection.InlineShapes(1).OLEFormat.ConvertTo _ ClassType:="Excel.Sheet.8", DisplayAsIcon:=True, _ IconFileName:="C:\WINDOWS\Application Data\Microsoft" _ & "\Installer\{00000409-78E1-11D2-B60F-006097C998E7}\xlicons.exe", _ IconIndex:=1, IconLabel:="Microsoft Excel Worksheet" End Sub

NOTE: If you do not select the embedded object before running the ConvertObject macro, the following error message appears:

Run-time error '5941':

The requested member of the collection does not exist.

For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

</li></ul>

Keywords: kbinfo KB235658

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.