How Word documents Reference Excel data

Source: Internet
Author: User

Prepare raw data. To show you how Word references Excel data, first, you create a spreadsheet called "Employee Information Basics. xlsx", which contains several records, each of which includes "name", "gender", "level", "expertise", and "department" attributes. In the specific application, may contain more attributes and content, in this only to play a role. The original data is shown in the figure.

When the raw data is ready, the next step is to refer to the data in Excel in Word. The specific implementation methods are: first select and copy the range of data you want to reference in your Excel document, and then in the Word document, select Start, click the Paste Drop-down list, choose Paste from, and select Paste link in the pop-up window, and on the right, choose Microsoft Office Excel document to image, click OK to complete the referencing Excel data operation.




If the content in the Excel document changes, such as changing advanced in the level attribute to "level", you will see that the contents of the Word document are also changed immediately, enabling synchronized updates of the data.

Using the above method to implement Word's reference to Excel data, there is an obvious disadvantage is that the reference data is not arbitrary, that is, it is not convenient or inconvenient to get the data in a customized format for display output. In order to be more flexible in referencing the data in Excel, DDE (Dynamic Data exchange) technology is needed to implement it. DDE is a protocol that allows two of applications to continuously and automatically exchange data through a DDE "channel". To control a DDE session between two applications, you need to establish a channel, select a topic, request and transfer data, and then close the channel. Here's a look at how to use DDE to reference data in Excel to Word.
To create a new Word document, the next feature we want to implement is to display the data in Excel in a Word document in the format shown in the following illustration. How to implement: Press the keyboard shortcut "Alt + F11" into VBA programming mode, right-click "Microsoft Word Object" and choose "Insert"-"mode" from the pop-up menu.


Enter the code as shown in the module and save it.

(Warm tip: the "staff information basic situation. xlsx" files and Word documents are all copied to the D-packing directory)

To open the Excel document, and then reopen the Word document, if the macro is disabled in the Word document, you need to enable the macros.

Macro-enabled: Click the "Options ..." button in the upper-left corner of the document, select "Enable this content" in the pop-up window, and click OK to enable the macro.

Place the cursor where you want to place the data, and then the Developer tab of the option, if you don't see the Developer tab, you need to set it to appear.

How to display development tools: Click "Start"-"Excel Options ..." in the upper-left corner of the window and select "Show the Developer tab on the Ribbon" in the pop-up dialog box.

Click "Macros", in the open window to select "Get Excel Data", click the Run button, the data will be displayed in a moment!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.