A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need merge doc to run a macro



 
 
Thread Tools Display Modes
  #1  
Old January 23rd, 2010, 12:30 AM posted to microsoft.public.word.mailmerge.fields
graywolf
external usenet poster
 
Posts: 30
Default Need merge doc to run a macro

I'm running Word 2003 SP3. I have a VB6/SP6 program that runs some queries
to get the needed data and then it takes a Word Merge document, connects it
to the datasource, and merges the data. It all works fine. Now I need to
enhance the merge. Part of what the VB program does is build a table in the
merge document that is basically a checklist. I need to have some of the
items in the checklist 'pre-checked' if you will. If every letter of the
merge had the same prechecked items it would be no problem, but I need to
change the prechecked items on each letter based on the recipient of the
letter. I thought I could create a macro in the merge document that would run
for each record merged and let the macro build the checklist and either check
or leave unchecked the items on the list based on the record being merged.
That macro would need to reference merge fields. Have no idea how to get
macro to run for each merge record, and don't know how to reference the merge
fields in the macro to do 'if..then... else' statements, etc.
Any help would be greatly appreciated. Thanks in advance.
  #2  
Old January 23rd, 2010, 02:19 AM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Need merge doc to run a macro

Instead of executing the mail merge, you might consider a variation of the
method in the article “Combining FormFields and Mail Merge” on the following
page of fellow MVP Graham Mayor’s website:

http://www.gmayor.com/Form_Fields_and_Mail_Merge.htm

There might also be some code of interest to you in the article on the
following page of fellow MVP Graham Mayor’s website:

http://www.gmayor.com/ManyToOne.htm


--
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, originally posted via msnews.microsoft.com

"Graywolf" wrote in message
...
I'm running Word 2003 SP3. I have a VB6/SP6 program that runs some
queries
to get the needed data and then it takes a Word Merge document, connects
it
to the datasource, and merges the data. It all works fine. Now I need to
enhance the merge. Part of what the VB program does is build a table in
the
merge document that is basically a checklist. I need to have some of the
items in the checklist 'pre-checked' if you will. If every letter of the
merge had the same prechecked items it would be no problem, but I need to
change the prechecked items on each letter based on the recipient of the
letter. I thought I could create a macro in the merge document that would
run
for each record merged and let the macro build the checklist and either
check
or leave unchecked the items on the list based on the record being merged.
That macro would need to reference merge fields. Have no idea how to get
macro to run for each merge record, and don't know how to reference the
merge
fields in the macro to do 'if..then... else' statements, etc.
Any help would be greatly appreciated. Thanks in advance.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.