specific record merge file into current document

T

THE Burg

I previously created a mail merge document with a merge source containing a
number of records. Now I find myself in a situation where I need to include
the entire merged document, for a specific record, in another document. The
record number is fixed. I already have a macro attached to the new document
so working with VBA to bring this about is not a problem.

Is this possible?
 
D

Doug Robbins - Word MVP

It is possible, but what is the data source, how would the macro identify
the record that is to be merged? Using mail merge may not be the best
method.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

THE Burg

The data source is Excel. The macro would identify the record by the record
number. Mail merge may not be the best, but I've already got the merge
document and database created and working....

The original document is a work instruction(WI) for manufacturing a family
of parts. Each family member has a sequential part number such as XYZABC1,
XYZABC2, ..... I've structured the database so that the record number matches
the "counter" extension to the part number (e.g. XYZABC25 is record 25.)

Now, I'm creating a WI for an assembly that includes a specific member of
the above family. Protocol requires that all WIs for the component members
of the assembly be included in the assembly WI. I could copy and paste the
data from the existing document, with the proper record selected, but then
I'd have two different places with (hopefully) the same information but no
guarantee that they'd stay the same over time.

The assembly document will have it's macro(s) run every time the WI is
printed which, if the macro went out and grabbed the existing WI, would
guarantee that the latest version of that WI was in the combined WI.

If there's a better way to get this done, I'm all ears!

Thanks in advance for the help!
 
D

Doug Robbins - Word MVP

I would change your mailmerge main document to a template and replace the
merge fields in it with {docvariable } fields. Then I would insert a
Userform into the template and on that userform, I would have a listbox that
I would populate with the data from the datasource, using the method in the
article "Load a ListBox from a Named Range in Excel using DAO" at:

http://www.word.mvps.org/FAQs/InterDev/FillListBoxFromXLDAO.htm

Then you would have a command button on the userform that used the
..BoundColumn property of the ListBox to iterate through each column of the
listbox, creating variables in the document with the values from each field
and then updated the fields in the document so that the values were
displayed in the corresponding docvariable fields.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top