+ Reply to Thread
Results 1 to 3 of 3

Transfering information from Excel to Word using VBA

  1. #1
    Registered User
    Join Date
    03-03-2012
    Location
    London England
    MS-Off Ver
    Excel 2010
    Posts
    1

    Transfering information from Excel to Word using VBA

    I need to transfer information from my excel spread sheet into an existing pre-formatted word template using VBA code.

    The pre-formatted word template contains different sections with both text and tables.

    I need to locate and update/replace text in the different sections of the word document from information from my excel spreadsheet.

    And also locate each table and insert information from my excel spreadsheet into the correct cells/tables in the different sections of the word document.

    Can anyone advise me with sample VBA source code to do this.

    Thanks

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,607

    Re: Transfering information from Excel to Word using VBA

    Why can't you paste special, link the table into the .Doc that will update when ever the .xls table is modified?
    Ben Van Johnson

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Transfering information from Excel to Word using VBA

    Leah is right. Copy a range in excel and then in word, right click >> paste special 'Paste Link' would be the easiest way for a small scale project/application. Full blown excel/word engines, be it document variable (think mail merge) or 'married' are beyond the scope of this forum (at least in my opinion).
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1