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.
Bookmarks