问题
At my office we use documents with merge fields from Microsoft Word for a number of different functions. However, I can't find a way to merge entire pages based on the value of a merge field. For instance, there are different forms you have to use to notarize documents in different state. I want to set it up so that if the state chosen is MN, the document will generate the notary form for Minnesota, if the state chosen is NC, the document will generate the notary form for NC, etc. Is this possible?
回答1:
Assuming your mailmerge main document is stored in the same folder as your State letters, you could use a field in the mailmerge main document coded as:
{QUOTE{INCLUDETEXT "{FILENAME \p}//..//{MERGEFIELD State}.docx"}}
where whatever is returned by {MERGEFIELD State} matches the document name. For example it could return Minnesota or MN provided that's what the document is named.
Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field constructions are all required.
来源:https://stackoverflow.com/questions/54582111/how-to-merge-entirely-different-pages-based-on-value-of-merge-field