+ Reply to Thread
Results 1 to 2 of 2

Opening Word mailmerge document from Excel using VBA

  1. #1
    Registered User
    Join Date
    07-31-2013
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Office 2013
    Posts
    5

    Opening Word mailmerge document from Excel using VBA

    Hi everybody,

    I am fairly new to working with this, but I have managed to create a mailmerge in Word that uses an Excel document to populate several fields.
    It also inserts graphics using INCLUDEPICTURE statements depending on a status that is specified in the Excel file. This will be a Red, Amber or Green circle. Which one of these it should be is stated in a mergefield which reads either RED, AMBER or GREEN. E.g. if value is RED, Word will pick the picture 'RED.png' and insert it. See fields on page 7 in Basic assessment.doc.

    The files are used to created personalised reports based on information that users specify in the Excel file. So the main document a user would work in is the Excel file.
    Ideally I would like to enable users to fire up the merge of fields into Word from the Excel file. I have found code to open the Word document from Excel and placed that under a button in Excel. See the code below, or see the button on worksheet "Final Rating - Recommendation" in Assessment Report Base File SAMPLE.xlsm.

    So here's my question:
    When I open the Word document using Word as one would normally do, a dialog pops up to say that it will link to fields in the Excel file ("Opening this document will run the following SQL command: SELECT * FROM 'MAILMERGEFIELDS'..." - where MAILMERGEFILEDS is the range in Excel I merge from), and update the fields according to the information in the Excel file. But if I use the code in Excel to open the document it wil just open the Word document and not start the mail merge link. This results in a document without updated field values, non-merged, just showing the last version I created and saved.

    Any help to tackle this would be much appreciated!
    Many thanks.

    P.S.: Attached both Worfd and Excel file. Merging won't work with the attached files because they aren't the originals used to create the link.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Last edited by BoldCreature; 09-16-2013 at 05:36 AM. Reason: Solved the issue

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Opening Word mailmerge document from Excel using VBA

    Is this solved?

    If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mailmerge from Excel and Word to new word document
    By PooH in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2011, 05:09 PM
  2. Opening Word document with Excel
    By Mr.Jones in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 01-11-2007, 10:13 AM
  3. Replies: 3
    Last Post: 03-14-2006, 10:20 AM
  4. opening an excel document in word
    By zoot in forum Excel General
    Replies: 4
    Last Post: 07-21-2005, 08:05 AM
  5. Replies: 1
    Last Post: 03-20-2005, 10:24 PM

Tags for this Thread

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