Updating excel from a word file

by  |  17-Jun-2019 20:23

However, you may find that you have one or more of the following problems: There are articles showing how to push data from Excel to Word using VBA, [see the following], but I hadn’t come across any that used Word as the driver when I had a recent need to do this. Sub Refresh All Tables() ''============================================================================== '' Purpose: To refresh the current table in a Word document with new data from '' the corresponding range in an Excel document.

The code needed to meet some specific criteria: Note: The sheet name is required because Word cannot reference an Excel range without knowing which sheet the range is on. If you like to use 3-letter acronyms for your ranges, you will have problems updating this code to Office 2007 because the native format in 2007 goes out to column XFD, and Excel won't let you use column or cell references as range names. '' The code uses bookmarks in the Word document and corresponding named ranges in '' Excel. This has the advantage that any '' formatting in the Excel document is retained, and the dimensions don't change '' significantly. Workbooks(i) Exit For End If Next Now we minimize the Excel window and hide the application. The first uses the Bookmarks table in the Excel file; the second contains the names of all bookmarks in the active Word document. Value 'loop through the bookmarks bmk Count = Active Document. Count Re Dim v Bookmarks(bmk Count - 1) j = LBound(v Bookmarks) For Each bmk In Active Document. Name j = j 1 Next bmk This section loops through all the bookmarks in the array, retrieving the Excel tables and pasting them into the word document.

Just copy the content from the Excel Sheet and paste it in the Word Document.

If you want to copy it as a single block, it is provided on this page.

var microsoft = microsoft || ; microsoft.support = microsoft.support || ; microsoft.support.content = (function(){ return { "click Tale Configuration": , "Internal Content Config": , "Mwf Configuration": , "Site Content Config": { "Link Farm Enabled": true, "One Site Service Uri": "https://uhf.microsoft.com//shell/xml/?

If you update the Excel sheet and open the Word document, it will ask you whether to update the document or not.

If you click “Yes” Word gets updated with the latest data.

'' Also, bookmarks are simpler to create and maintain because a picture is only a '' single character in a Word document. It could also be modified to ensure that they pick an Excel file with a table called Bookmarks, located on the List sheet. This section checks to see whether the selected file is already open; if not, it is opened. We also set an object reference to the Excel workbook, to simplify the code later on. A few points are worth commenting on: There are some quirks to using pictures with bookmarks.

Community Discussion