Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro execution using MailMerge nelsonj Mailmerge 9 June 13th 06 05:04 PM
WORD 2002: How to stop recording Word Macro to allow for user inpu Hershmab Microsoft Word Help 1 April 6th 06 01:41 PM
Word XP - Recording a Macro Cokes Microsoft Word Help 1 August 8th 05 03:27 PM
Mailmerge by macro J.Reynolds Mailmerge 5 June 17th 05 09:36 PM
Possible bug when recording a Word Macro Raven95 Microsoft Word Help 4 April 30th 05 09:49 PM


All times are GMT +1. The time now is 12:21 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"