Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Macro not recording mailmerge
I am using Word 2003. I am trying to get a macro to record the following
commands: Open Data Source Mail Merge Recipients Merge to New Document The first and last commands are recorded. But the Mail Merge Recipients part of my actions is not recorded. Is this normal? How can I fix or get around it? Thanks |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Macro not recording mailmerge
It's normal. Lots of things don't record.
In this case you can probably do Dialogs(wdDialogMailMergeRecipients).Display Generally speaking if you are using Dialog boxes and need to access any fields they may have exposed, you need to do something more like the following but I do not think it is necessary in this case: Dim dlgMailMergeMRecipients As Dialog Set dlgMailMergeMRecipients = Dialogs(wdDialogMailMergeRecipients) dlgMailMergeMRecipients.Display Set dlgMailMergeMRecipients = Nothing Peter Jamieson "LDanix" wrote in message ... I am using Word 2003. I am trying to get a macro to record the following commands: Open Data Source Mail Merge Recipients Merge to New Document The first and last commands are recorded. But the Mail Merge Recipients part of my actions is not recorded. Is this normal? How can I fix or get around it? Thanks |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Macro not recording mailmerge
"Dialogs(wdDialogMailMergeRecipients).Display" worked to get the box to
display. Now I need it to do a few things there before closing and executing the merge. If its possible, would you mind helping me with the code? If you don't, here's what I need: 1. Clear All 2. Filter column "CurrentStatus" to only display "Active" 3. Select All 4. Close Dialog Box After the merge has executed, I would like to have it close the original document and keep the newly created document open. Thanks in advance "Peter Jamieson" wrote: It's normal. Lots of things don't record. In this case you can probably do Dialogs(wdDialogMailMergeRecipients).Display Generally speaking if you are using Dialog boxes and need to access any fields they may have exposed, you need to do something more like the following but I do not think it is necessary in this case: Dim dlgMailMergeMRecipients As Dialog Set dlgMailMergeMRecipients = Dialogs(wdDialogMailMergeRecipients) dlgMailMergeMRecipients.Display Set dlgMailMergeMRecipients = Nothing Peter Jamieson "LDanix" wrote in message ... I am using Word 2003. I am trying to get a macro to record the following commands: Open Data Source Mail Merge Recipients Merge to New Document The first and last commands are recorded. But the Mail Merge Recipients part of my actions is not recorded. Is this normal? How can I fix or get around it? Thanks |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Macro not recording mailmerge
OK, as far as I know you cannot mainpulate this particular dialog box to
that level. Some Dialog boxes in Word are more programmable than others. The way to achieve this particular result is to generate the SQL query you need to get the correct data, and either a. issue it in an OpenDataSource call or b. use it to set ActiveDcocument.Mailmerge.Datasource.Querystring (generally speaking, (b) sometimes works, and (a) should always work as long as the data source is disconnected before you start). The precise query depends on which type of data source you are using (different dialects of SQL are used, and the way that the "table" is named in the SQL can vary), but if you apply the criteria you want manually, then use the Immediate window in VBE to print the value of ActiveDocument.Mailmerge.Datasource.Querystring you should see what is required for (b). It will be something like SELECT * FROM mytable WHERE CurrentStatus = 'Active' See where that leads you - if you need more on OpenDataSource, I have posted many examples in this group so searching for Jamieson OpenDataSource on Google Groups may help. Peter Jamieson "LDanix" wrote in message ... "Dialogs(wdDialogMailMergeRecipients).Display" worked to get the box to display. Now I need it to do a few things there before closing and executing the merge. If its possible, would you mind helping me with the code? If you don't, here's what I need: 1. Clear All 2. Filter column "CurrentStatus" to only display "Active" 3. Select All 4. Close Dialog Box After the merge has executed, I would like to have it close the original document and keep the newly created document open. Thanks in advance "Peter Jamieson" wrote: It's normal. Lots of things don't record. In this case you can probably do Dialogs(wdDialogMailMergeRecipients).Display Generally speaking if you are using Dialog boxes and need to access any fields they may have exposed, you need to do something more like the following but I do not think it is necessary in this case: Dim dlgMailMergeMRecipients As Dialog Set dlgMailMergeMRecipients = Dialogs(wdDialogMailMergeRecipients) dlgMailMergeMRecipients.Display Set dlgMailMergeMRecipients = Nothing Peter Jamieson "LDanix" wrote in message ... I am using Word 2003. I am trying to get a macro to record the following commands: Open Data Source Mail Merge Recipients Merge to New Document The first and last commands are recorded. But the Mail Merge Recipients part of my actions is not recorded. Is this normal? How can I fix or get around it? Thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro execution using MailMerge | Mailmerge | |||
WORD 2002: How to stop recording Word Macro to allow for user inpu | Microsoft Word Help | |||
Word XP - Recording a Macro | Microsoft Word Help | |||
Mailmerge by macro | Mailmerge | |||
Possible bug when recording a Word Macro | Microsoft Word Help |