A Microsoft Outlook email forum. Outlook Banter

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 » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Direct mail merge documents to drafts folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 13th 07, 11:36 PM posted to microsoft.public.outlook.program_vba
Edward
external usenet poster
 
Posts: 56
Default Direct mail merge documents to drafts folder

Hi everyone,
I use mailmerge in word to create email messages for different recipients
but the problem i have is after I create the merged document it automatically
sends the emails to each recipient I wonder if there is way to send thoses
emails to my drafts folder because I want to attach some files o each email
and then send them manually, It's okay if the soultion needs VBA becasue Im
familiar with VBA .
--
Best regards,
Edward
Ads
  #2  
Old November 14th 07, 07:59 AM posted to microsoft.public.outlook.program_vba
JP[_2_]
external usenet poster
 
Posts: 18
Default Direct mail merge documents to drafts folder

Why not use VBA to attach the files to the email? There's an
Attachments.Add property in Outlook, there should be similar property
in Word.


HTH,
JP

On Nov 13, 6:36 pm, Edward wrote:
Hi everyone,
I use mailmerge in word to create email messages for different recipients
but the problem i have is after I create the merged document it automatically
sends the emails to each recipient I wonder if there is way to send thoses
emails to my drafts folder because I want to attach some files o each email
and then send them manually, It's okay if the soultion needs VBA becasue Im
familiar with VBA .
--
Best regards,
Edward



  #3  
Old November 14th 07, 11:53 AM posted to microsoft.public.outlook.program_vba
Edward
external usenet poster
 
Posts: 56
Default Direct mail merge documents to drafts folder

Thanks JP but how is it possible to use attachment during mailmerge ? I want
to attach a specific file to each email lets say for Mr. X attach X.pdf and
Mr. Y attach Y.pdf ,...
--
Best regards,
Edward


"JP" wrote:

Why not use VBA to attach the files to the email? There's an
Attachments.Add property in Outlook, there should be similar property
in Word.


HTH,
JP

On Nov 13, 6:36 pm, Edward wrote:
Hi everyone,
I use mailmerge in word to create email messages for different recipients
but the problem i have is after I create the merged document it automatically
sends the emails to each recipient I wonder if there is way to send thoses
emails to my drafts folder because I want to attach some files o each email
and then send them manually, It's okay if the soultion needs VBA becasue Im
familiar with VBA .
--
Best regards,
Edward




  #4  
Old November 14th 07, 01:17 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Direct mail merge documents to drafts folder

You can't. You would need to use Outlook automation, not Word mail merge, to create individual messages and attach the files.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Edward" wrote in message ...
Thanks JP but how is it possible to use attachment during mailmerge ? I want
to attach a specific file to each email lets say for Mr. X attach X.pdf and
Mr. Y attach Y.pdf ,...
--
Best regards,
Edward


"JP" wrote:

Why not use VBA to attach the files to the email? There's an
Attachments.Add property in Outlook, there should be similar property
in Word.


HTH,
JP

On Nov 13, 6:36 pm, Edward wrote:
Hi everyone,
I use mailmerge in word to create email messages for different recipients
but the problem i have is after I create the merged document it automatically
sends the emails to each recipient I wonder if there is way to send thoses
emails to my drafts folder because I want to attach some files o each email
and then send them manually, It's okay if the soultion needs VBA becasue Im
familiar with VBA .
--
Best regards,
Edward




  #5  
Old November 14th 07, 01:51 PM posted to microsoft.public.outlook.program_vba
JP[_2_]
external usenet poster
 
Posts: 18
Default Direct mail merge documents to drafts folder

Sue is right. You may need to re-write your routine to use Outlook to
attach the messages. I use Excel to find the attachment, open Word and
do the mail merge, then tell Outlook to craft a msg and send it out
with the attachment. If you use a unique filename to identify each
recipient, you can tell Outlook to include the appropriate attachment.
Here is a sample of what I use (heavily scrubbed to protect the
innocent).

Dim FName As String, sRecipName As String, X As String
Dim Outlook As Outlook.Application
Dim OutlookMsg As Outlook.MailItem
Dim OutlookRecip As Outlook.Recipient
Dim OutlookAttach As Outlook.Attachment

FName = Dir("C:\Documents And Settings\jsmith\Desktop\*.doc")

On Error Resume Next
Set Outlook = GetObject("outlook.application")
If Err.Number 0 Then
Set Outlook = CreateObject("outlook.application")
End If
On Error GoTo 0

Do While Len(FName) 0
' this uses the filename to identify the recipient
' i.e. if the filename is johnsmith.doc then X would =
"johnsmith"
X = Left(FName, WorksheetFunction.Find(".", X) - 1)

Set OutlookMsg = Outlook.CreateItem(olMailItem)

With OutlookMsg
.SentOnBehalfOfName =
"
.ReplyRecipients.Add
")
.Subject = "Please review the attachment, it is customized
for your location."
.Importance = olImportanceHigh
.Sensitivity = olConfidential
.BodyFormat = olFormatHTML
.HTMLBody = "pHere's the file you asked for " & _
" to review prior to our meeting./pbrpPlease send
me your feedback./p"

Select Case X
Case "johnsmith"
sRecipName = "
Case "maryjones"
sRecipName = "
Case "robertsmith"
sRecipname = "
' add additional case statements here as needed to
identify the recipient
Case Else
End Select

Set OutlookRecip = .Recipients.Add(sRecipName)
OutlookRecip.Type = olTo

' this attaches the correct file for the correct recipient
Set OutlookAttach = .Attachments.Add("C:\Documents And
Settings\jsmith\Desktop\" & FName)

.Send
' or .Display

FName = Dir
End With
Loop

Set OutlookRecip = Nothing
Set OutlookAttach = Nothing
Set OutlookMsg = Nothing
Set Outlook = Nothing


You would need to do your mail merge in Excel or Word and have the
program name the files with a unique filename (location code,
recipient name, etc) that you could use to identify the recipient.
Assuming you did your mail merge and placed all the files on the
desktop, the variable FName uses Dir to get the first desktop file
that ends in .doc. Then it takes the filename and uses it to determine
the correct recipient (The "Select Case" statement) and attaches
the .doc to the email.

Beware Outlook security warning!

HTH,
JP

On Nov 14, 6:53 am, Edward wrote:
Thanks JP but how is it possible to use attachment during mailmerge ? I want
to attach a specific file to each email lets say for Mr. X attach X.pdf and
Mr. Y attach Y.pdf ,...
--
Best regards,
Edward



"JP" wrote:
Why not use VBA to attach the files to the email? There's an
Attachments.Add property in Outlook, there should be similar property
in Word.


HTH,
JP



  #6  
Old October 14th 08, 05:58 PM posted to microsoft.public.outlook.program_vba
Curt
external usenet poster
 
Posts: 19
Default Direct mail merge documents to drafts folder

Trying to follow but I get lost. I am trying to attach a word.doc to all
entries in a contact group in outlook Have never tryed this befor. Your code
gives me a start
Thanks

"JP" wrote:

Sue is right. You may need to re-write your routine to use Outlook to
attach the messages. I use Excel to find the attachment, open Word and
do the mail merge, then tell Outlook to craft a msg and send it out
with the attachment. If you use a unique filename to identify each
recipient, you can tell Outlook to include the appropriate attachment.
Here is a sample of what I use (heavily scrubbed to protect the
innocent).

Dim FName As String, sRecipName As String, X As String
Dim Outlook As Outlook.Application
Dim OutlookMsg As Outlook.MailItem
Dim OutlookRecip As Outlook.Recipient
Dim OutlookAttach As Outlook.Attachment

FName = Dir("C:\Documents And Settings\jsmith\Desktop\*.doc")

On Error Resume Next
Set Outlook = GetObject("outlook.application")
If Err.Number 0 Then
Set Outlook = CreateObject("outlook.application")
End If
On Error GoTo 0

Do While Len(FName) 0
' this uses the filename to identify the recipient
' i.e. if the filename is johnsmith.doc then X would =
"johnsmith"
X = Left(FName, WorksheetFunction.Find(".", X) - 1)

Set OutlookMsg = Outlook.CreateItem(olMailItem)

With OutlookMsg
.SentOnBehalfOfName =
"
.ReplyRecipients.Add
")
.Subject = "Please review the attachment, it is customized
for your location."
.Importance = olImportanceHigh
.Sensitivity = olConfidential
.BodyFormat = olFormatHTML
.HTMLBody = "pHere's the file you asked for " & _
" to review prior to our meeting./pbrpPlease send
me your feedback./p"

Select Case X
Case "johnsmith"
sRecipName = "
Case "maryjones"
sRecipName = "
Case "robertsmith"
sRecipname = "
' add additional case statements here as needed to
identify the recipient
Case Else
End Select

Set OutlookRecip = .Recipients.Add(sRecipName)
OutlookRecip.Type = olTo

' this attaches the correct file for the correct recipient
Set OutlookAttach = .Attachments.Add("C:\Documents And
Settings\jsmith\Desktop\" & FName)

.Send
' or .Display

FName = Dir
End With
Loop

Set OutlookRecip = Nothing
Set OutlookAttach = Nothing
Set OutlookMsg = Nothing
Set Outlook = Nothing


You would need to do your mail merge in Excel or Word and have the
program name the files with a unique filename (location code,
recipient name, etc) that you could use to identify the recipient.
Assuming you did your mail merge and placed all the files on the
desktop, the variable FName uses Dir to get the first desktop file
that ends in .doc. Then it takes the filename and uses it to determine
the correct recipient (The "Select Case" statement) and attaches
the .doc to the email.

Beware Outlook security warning!

HTH,
JP

On Nov 14, 6:53 am, Edward wrote:
Thanks JP but how is it possible to use attachment during mailmerge ? I want
to attach a specific file to each email lets say for Mr. X attach X.pdf and
Mr. Y attach Y.pdf ,...
--
Best regards,
Edward



"JP" wrote:
Why not use VBA to attach the files to the email? There's an
Attachments.Add property in Outlook, there should be similar property
in Word.


HTH,
JP




  #7  
Old January 13th 16, 04:19 PM
David Meek David Meek is offline
Junior Member
 
First recorded activity at Outlookbanter: Jan 2016
Posts: 1
Default

Quote:
Originally Posted by Edward View Post
Hi everyone,
I use mailmerge in word to create email messages for different recipients
but the problem i have is after I create the merged document it automatically sends the emails to each recipient I wonder if there is way to send those emails to my drafts folder because I want to attach some files o each email and then send them manually, It's okay if the soultion needs VBA becasue I'm familiar with VBA .
--
Best regards,
Edward
The simplest way to accomplish this is to un-check the 'Send Immediately when Connected' option - found under Outlook Options Advanced Send and Receive.

Then perform your mail-merge as usual, and the emails will be created in your Outbox. Simply drag them from there to your Drafts folder, and attach your files.

Cheers,
Dave.
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Attach documents to mail merged emails based on merge fields bony_tony Outlook and VBA 1 June 20th 07 11:52 AM
Folder List and Mail Merge Kevin Gal Outlook - Using Contacts 9 November 1st 06 11:31 PM
How to direct output from Word mail merge to multiple Word documents [email protected] Outlook - General Queries 3 August 11th 06 04:10 AM
Mail Merge from Outlook opens up two MS Word documents. [email protected] Outlook - General Queries 10 July 6th 06 09:44 PM
How to direct mail to specific folder crapit Outlook - General Queries 2 May 16th 06 02:47 AM


All times are GMT +1. The time now is 07:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.