Re: Automate multiple mail merges
- From: "Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 8 Sep 2006 22:00:15 +0200
See the bit about the Express Click Yes utility in the Preparations section
of the article "Mail Merge to E-mail with Attachments" at:
http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.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
"mjkx" <mjkx@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3CFCBAC3-00A4-464D-BD44-23FEE423DA5F@xxxxxxxxxxxxxxxx
OK, I'm making pretty good progress, but have another question. The
machines
that will be used to run these merges are locked down and users wont be
able
to make changes to the registry. I have adapted the code to
programmatically
set the data source as well as the specific query string for each
template.
This has resolved the problem of the prompt each time a template opens and
tries to apply the filter. I have been executing the merge to a new
document
for testing and everything seems to be working beautifully.
The problem I'm encountering now is that when I merge to email rather than
to a document, Outlook prompts for permission to access the address book
and
then asks for permission to send each email. The specific dialog is "A
program is trying to automatically send e-mail on your behalf. Do you
want
to allow this?" These merges generate hundreds of emails. Is there a way
to
overcome this prompt? I have signed the macro and it should be trusted,
but
that does not stop the security warning.
Thanks in advance
"Doug Robbins - Word MVP" wrote:
If the documents were saved after the data source was attached to them
you
should be be being asked for the data source unless its the following
message that you are getting when you start talking about SQL:
"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document "
If that is the case, see:
http://support.microsoft.com?kbid=825765
--
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
"Matt" <Matt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5EAA73FC-52E2-4CE0-BE26-2819AD6A8820@xxxxxxxxxxxxxxxx
Fantastic! Thank you very much.
2 ongoing issues:
1) I'd like to be able to set the location of the data source using
the
macro as well. Currently I get prompted with each template to point to
the
spread***.
2) Each of the templates filters the data in the data source so I
get
prompted with each to allow the SQL Query to execute. I'd like to be
able
to
either programmatically set the SQL query for each template, or
programmatically allow the existing query to run without being
prompted.
Any ideas? Thanks again.
"Doug Robbins - Word MVP" wrote:
The following code has not been tested, but should do what you want if
you
supply the correct name for the field containing the email addresses:
Dim MyPath As String
Dim MyName As String
Dim maindoc As Document
'let user select a path
With Dialogs(wdDialogCopyFile)
If .Display() <> -1 Then Exit Sub
MyPath = .Directory
End With
'strip quotation marks from path
If Len(MyPath) = 0 Then Exit Sub
If Asc(MyPath) = 34 Then
MyPath = Mid$(MyPath, 2, Len(MyPath) - 2)
End If
'get files from the selected path
'and insert them into the doc
MyName = Dir$(MyPath & "*.*")
Do While MyName <> ""
Set maindoc = Documents.Open(MyName)
With maindoc.MailMerge
.MailAddressFieldName = "nameoffieldcontainingemailaddresses"
.MailSubject = "subjectofemailmessage"
.Destination = wdSendToEmail
.Execute
End With
maindoc.Close wdDoNotSaveChanges
MyName = Dir
Loop
--
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
"mjkx" <Matt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7D9AB99B-968F-43F3-916B-DBE2778EA228@xxxxxxxxxxxxxxxx
I have 40+ mail merge templates in Word 2003 which all share a single
Excel
2003 spread*** as a data source. I would like to be able to
automate
the
merge of each of these documents from a single macro. For example,
I'd
like
to be able to open a single Word document, run a macro which opens
each
of
the mail merge templates in turn and completes the merge to email.
Is
this a
reasonable request and can anyone point me in the right direction?
Thanks in advance for any advice!
.
- References:
- Re: Automate multiple mail merges
- From: Matt
- Re: Automate multiple mail merges
- From: Doug Robbins - Word MVP
- Re: Automate multiple mail merges
- From: mjkx
- Re: Automate multiple mail merges
- Prev by Date: Re: Mail merge and long tables
- Next by Date: Re: IF THEN ELSE
- Previous by thread: Re: Automate multiple mail merges
- Next by thread: Re: Can I set a default data source location?
- Index(es):