Word Mail Merge

Source: Internet
Author: User

In the past two days, the customer needs to pass the application information in the databaseWordPrint it out, so we export the database recordsExcelIn the file, the customer makes it by themselvesWordTemplate document, and then print it using the Mail Merge functionExcelBut encountered a problem when processing the photo.

 

ExcelThe file stores the image file path of the applicant,WordWhen printing, You need to print the actual image (2000(Left and right), it is not advisable to insert images one by one, so I want to continue to use the insert domain method for processing:

 

Theoretically, it should be possible. In actual use, we find that the first image is always displayed, and you need to manually PressF9To refresh the image. If you use "merge to New Document", you cannot refresh the image. This is indeed a headache.

 

After a long time, I made a macro:

Sub Preview ()

'

'Preview macro

'Macro was recorded by XXX in

'

Dim data as mailmergedatasource

Set Data = activedocument. mailmerge. datasource

Data. activerecord = wdfirstdatasourcerecord

Selection. Fields. Update

For I = 1 to data. recordcount

Activedocument. printpreview

Msgbox ("no." + STR (I) + "records are printed. ")

'Activedocument. Printout

Data. activerecord = wdnextrecord

Selection. Fields. Update

Next

End sub

 

Haha, stupid. First, locate the first record, refresh the image (when opening the document, select the image domain first), print it, and move it to the next record, until all records are printed.

 

Although the problem is solved in this way, it is always uncomfortable and cannot be merged into new documents. It is always inconvenient to print a few or more documents. Think about it. If the template document just inserts the includepictur domainCodeInstead of the actual image, it is more appropriate to insert the actual image in the merged document.

 

InOffice onlineSearch for domain information on the website and findSetYou can set tags for the domain, so you can process them as follows:

 

 

The merged document contains the following content:

 

Switch to the domain result view (CTRL + F9), And then select all (CTRL +), And then pressF9Update domain, everythingOK.

 

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.