Re: conditional macro at end of merge



On Oct 13, 2:44 pm, "Doug Robbins - Word MVP"
<d...@xxxxxxxxxxxxxxxxxx> wrote:
If I had to do something like this, I would not use mailmerge as the basis.
Rather, instead of using a mailmerge main document, I would create a
template that had {DOCVARIABLE} fields where you would have had mergefields
in a mail merge main document and then I would use VBA to iterate through
the Access Table/Query, creating a new document from the template for each
record and creating variables in that document that would contain the data
from each field in that record.  The code would also call the macro to be
executed on that document if there was one in that field of the record.

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

<slickd...@xxxxxxxxx> wrote in message

news:636c781f-cc53-4421-84fa-c1b1c09fffed@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a generic MSAccess module that starts MSWord and merges a form
file with a data file.  I create the data file through a TransferText
command that stores the MSAccess record as a text delimited file.

I want my Access module to further handle this requirement:

If [NameOfAdditionalMacroNeeded] field from the data file is not
blank, find the macro by that name in the user’s MSWord normal.dot
and
execute it at the end of the merge.

Access groups are telling me to go to this group for help.

Can anyone help? Thank you.  I'm a rookie at VBA, so please go easy
on
me!

Thank you Doug. I am currently exporting the data from the selected
record into a text file to merge with my Word mail merge doc. To use
your solution, would I still be merging, or populating my template,
with these fields in the text file? Or would I have to change my
technique and store the desired record in a temporary table in Access,
populating the template with that?

I have never worked with templates. Can you point me to some examples?
.



Relevant Pages

  • Re: script to send out a dozen letters?
    ... You could definitely tweak it to find/replace a LaTeX template and send ... You must include the To, From, Cc, and Subject headers. ... Column titles (see The Data File section) will be substituted with the ... As such, if you have cc or bcc recipients, ...
    (freebsd-questions)
  • Re: script to send out a dozen letters?
    ... Here's a script I whipped up a year or two ago that sends out e-mails. ... You could definitely tweak it to find/replace a LaTeX template and send ... You must include the To, From, Cc, and Subject headers. ... Column titles (see The Data File section) will be substituted with the ...
    (freebsd-questions)
  • Re: Simple macro used to work...?
    ... I have tested your code (changing only the templatename and the data file) ... This macro puts the firstname field ... from the data file into a table (the template), ... merges to the ActivePrinter. ...
    (microsoft.public.word.docmanagement)
  • Re: Directory Merge - 2003
    ... Now the reason why I wanted to use the template design is because all of the ... again for each data file and add it to an existing publication. ... The catalog merge is terrific for directories. ... I have created an address directory that has multiple entries. ...
    (microsoft.public.publisher)
  • Help!
    ... I have an Excel application which is based on two files: ... and open a new data file based on a template. ... Help says this command will run a macro written in Visual ...
    (microsoft.public.excel.programming)