Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assign field to a variable
I wish to assign a field to a document variable and then "massage" the
variable in VBA. That way the massaged variable can be inserted into the main document where needed. Thanks. David |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assign field to a variable
Hi Fscodave,
I wish to assign a field to a document variable and then "massage" the variable in VBA. That way the massaged variable can be inserted into the main document where needed. In the mail merge FAQ on my website you'll find a section on Word 2002/2003, and in there a discussion about using the mail merge events. There's a sample file that demonstrates basically what you need to do (manipulate the value of the merge field and put it in the document) http://homepage.swissonline.ch/cindy...002/MM2002.htm Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005) 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 :-) |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assign field to a variable
Thanks. Mark, in a message on Sept. 2, had asked something similar, so
I posted your answer to him. Hope that's not a breach of netiquette. I then tried to figure out what was going on. I don't know much about VBA, admittedly, and I see some dreaded "SQL" bits in your macro. When I ran the merge, I only got the first 2 records to show up, but I did see the initials for the 2 records that did work (the first two). Oh well, and not to be grumpy, honest, but WP had relatively simple merge commands to do that directly as part of the merge (see my admittedly grumpy riposte in that thread that Mark started, and Peter Jamieson telling me to cool it). I know, I know, move on, forget about it, but still... Anyway, thanks very much. Maybe in a few months of VBA study I'll be able to understand everything you did. Very impressive, in any event. Cindy M. wrote: Hi Fscodave, I wish to assign a field to a document variable and then "massage" the variable in VBA. That way the massaged variable can be inserted into the main document where needed. In the mail merge FAQ on my website you'll find a section on Word 2002/2003, and in there a discussion about using the mail merge events. There's a sample file that demonstrates basically what you need to do (manipulate the value of the merge field and put it in the document) http://homepage.swissonline.ch/cindy...002/MM2002.htm Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005) 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 :-) |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assign field to a variable
Hi Fscodave,
When I ran the merge, I only got the first 2 records to show up You might check that code for a line with .Execute in it (as in document.MailMerge.Execute). See if it's followed by "false". I thought I updated the example, but maybe not... FWIW, this appears to be a resource issue, which is probably why Peter doesn't sugget this approach very often. On some machines, it processes everything. Others get only one record. I went 'round with Microsoft on this and they simply can't reproduce the problem. But they seem to firmly believe that setting this parameter to "false" should fix it. And yes, I came from WordPerfect to Word over 15 years ago. Mail merge is really the one thing MS just can't seem to understand or get right sigh. Depending on the requirements, I 1. Create an Access report 2. Pre-process the data in the data source 3. Use VBA instead of mail merge Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005) 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 :-) |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assign field to a variable
Well, happily, our organization is going to call in a bunch of experts. Project size etc. unknown, but they'll be able to figure out what can and can't be done. Anyway, it's been a trip trying to figure this stuff out! fscodave out |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mailmerge - Firstname truncate to Initial?... | Mailmerge | |||
Word: IF statement to merge a field only if another Field is popul | Mailmerge | |||
Suppressing Merge Field and text before/after | Microsoft Word Help | |||
Page x of y problems | Microsoft Word Help | |||
Text Form Field Ref in Footer Won't Update on Screen | Microsoft Word Help |