Mailmerging without mailmerge object

S

Steven Packard

OK, I have got to find a way to duplicate the
functionality of the mailmerge object as it relates to the
merge process. The mailmerge object does not do what I
need it to do so I want to see if I can use ADO and
duplicate the merge process. It appears that the merge
process separates each instance of the document with a
section break (starting each section on a new page). I
tried out the section breaks interactively and in VBA and
it looks great. I have the .insertafter method down
pretty well I think. What I still am a little nervous
though about is how to get the "main document" (the
original body of the template without the code but
including all the headers, footers, and footnotes,
graphics, etc. to duplicate along with their bookmarks so
that I can reference them for each record in my
recordset. Has anyone done this? If I can figure this
out, I might be able to do the 3-D merges and handle long
sql statements (assuming I can pass a recordset to a
template).

Ideas?

Steven
 
D

Doug Robbins

See the "Multiple items per condition" item under the "Special merges"
section of fellow MVP CIndy Meister's website at

http://homepage.swissonline.ch/cindymeister/MergFram.htm


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
S

Steven Packard

I appreciate your response. I read the Meister article
thoroughly. It was helpful but dealt with stuff I already
knew. What I am trying to find out is how to append
another instance of the "maindocument" at the end of the
merge document I am building. I have experimented using
the section objects but have not been very successful.
My "maindocument" has headers/footers, graphics,
footnotes, and body. Is there a method or object that can
be used to slap another instance of the main document at
the end of the document I am building? I want to do this
for each record in my ADO recordset. I don't want to just
open new documents based on the "main document" because
that would open up hundreds of documents. I would rather
have one merge document a hundred pages long than 100
separate documents, each of which have to be printed and
closed.

Any help would be greatly appreciated.

Steven
 
S

Steven Packard

I am experimenting with the range.copy and range.paste
methods. I make a master copy of the main document using
MainRange.copy and then pasting it at the end of the
workingrange object (the range of the working document).
Of course I insert a section break between instances of
the main document. This seems like it is going to work.
I will try them with bookmarks and if they work (i.e., I
can distinguish between the bookmarks of different
sections even if they are just copies of each other and
therefore have the same name.) I will let everyone know.
 
C

Cindy M -WordMVP-

Hi Steven,

Bookmarks won't work. By definition, a bookmark must be
unique in a document. When you insert or paste text with
duplicate bookmarks, one set will be removed (which set
depends a bit on the version of Word, and how the duplicates
are coming in).

Since you're doing this via automation, I suggest:
- store the "copy" of the main document as an AUTOTEXT
entry in the documents' template

- The bookmarks in the AutoText entry should be
"generic", and you increment them with a number as the
AutoText is inserted (i.e. the AutoText has txt, the first
copy renames to txt1 after it has been inserted, the next
txt2, etc.)
I am experimenting with the range.copy and range.paste
methods. I make a master copy of the main document using
MainRange.copy and then pasting it at the end of the
workingrange object (the range of the working document).
Of course I insert a section break between instances of
the main document. This seems like it is going to work.
I will try them with bookmarks and if they work (i.e., I
can distinguish between the bookmarks of different
sections even if they are just copies of each other and
therefore have the same name.) I will let everyone know.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun
8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
S

Steven Packard

This sounds great. I think the renamed bookmarks will
work perfectly. I am having, however, a bit of a problem
getting the entire "Main Document" into the Autotext. I
can get the main body (including the graphics, etc.) which
I use for part of my letterhead, but I cannot seem to get
the headers and footers in. Any ideas?

Steven
 
C

Cindy M -WordMVP-

Hi Steven,
This sounds great. I think the renamed bookmarks will
work perfectly. I am having, however, a bit of a problem
getting the entire "Main Document" into the Autotext. I
can get the main body (including the graphics, etc.) which
I use for part of my letterhead, but I cannot seem to get
the headers and footers in. Any ideas?
Mmmmm. You might try including a section break before and
after the text. Make sure the headers/footers are defined for
that section, and that "Same as previous" is turned off for
that and the following section.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun
8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

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