Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Faisal Ijaz Faisal Ijaz is offline
external usenet poster
 
Posts: 2
Default mail merge with different subjects

I have to sent email messages with mail merge with different subjects. I have
excel sheet which contains subject, email address fields. please help
--
With gratitude,

Faisal Ijaz
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default mail merge with different subjects

You cannot do it with mail merge out-of-the-box.

You could do it with a modification of the code used in the the article
"Mail Merge to E-mail with Attachments" at:

http://word.mvps.org/FAQs/MailMerge/...ttachments.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, originally posted via msnews.microsoft.com

"Faisal Ijaz" wrote in message
...
I have to sent email messages with mail merge with different subjects. I
have
excel sheet which contains subject, email address fields. please help
--
With gratitude,

Faisal Ijaz


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default mail merge with different subjects

You cannot do it with mail merge out-of-the-box.

You could do it with a modification of the code used in the the article
"Mail Merge to E-mail with Attachments" at:

http://word.mvps.org/FAQs/MailMerge/...ttachments.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, originally posted via msnews.microsoft.com

"Faisal Ijaz" wrote in message
...
I have to sent email messages with mail merge with different subjects. I
have
excel sheet which contains subject, email address fields. please help
--
With gratitude,

Faisal Ijaz


  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default mail merge with different subjects

If you are familiar with VBA, another way is to use Word's MailMerge
events and VBA to specify the subject for each email.
e.g. assuming that the subject text comes from a field in your dta
source called "mysubjectfield", in the VBA Editor, Insert a new Class
Module, name it EventClassModule, and insert the following code:

Public WithEvents App As Word.Application
Private Sub App_MailMergeBeforeRecordMerge( _
ByVal Doc As Document, _
Cancel As Boolean)
' set this to be the exact name
' of the field you want to use
' (uppercase/lowercase are
' significant here)
Const strSubjectFieldName = "mysubjectfield"
Doc.MailMerge.MailSubject = _
Doc.MailMerge.DataSource.DataFields(strSubjectFiel dName).Value
End Sub

In an ordinary module, put the following VBA
'---
Dim x As New EventClassModule
Sub MergeWithEvents()
EnableEventHandler
' Do the merge
ActiveDocument.MailMerge.Execute Pause:=False
' The events fire for all documents
' so disable them
DisableEventHandler
End Sub

Sub EnableEventHandler()
Set x.App = Word.Application
End Sub

Sub DisableEventHandler()
Set x.App = Nothing
End Sub
'---
Then, with your mail merge main document open, run the MergeWithEvents
subroutine to run your merge


Peter Jamieson

http://tips.pjmsn.me.uk

On 30/04/2010 06:41, Faisal Ijaz wrote:
I have to sent email messages with mail merge with different subjects. I have
excel sheet which contains subject, email address fields. please help

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default mail merge with different subjects


If you are familiar with VBA, another way is to use Word's MailMerge
events and VBA to specify the subject for each email.
e.g. assuming that the subject text comes from a field in your dta
source called "mysubjectfield", in the VBA Editor, Insert a new Class
Module, name it EventClassModule, and insert the following code:

Public WithEvents App As Word.Application
Private Sub App_MailMergeBeforeRecordMerge( _
ByVal Doc As Document, _
Cancel As Boolean)
' set this to be the exact name
' of the field you want to use
' (uppercase/lowercase are
' significant here)
Const strSubjectFieldName = "mysubjectfield"
Doc.MailMerge.MailSubject = _
Doc.MailMerge.DataSource.DataFields(strSubjectFiel dName).Value
End Sub

In an ordinary module, put the following VBA
'---
Dim x As New EventClassModule
Sub MergeWithEvents()
EnableEventHandler
' Do the merge
ActiveDocument.MailMerge.Execute Pause:=False
' The events fire for all documents
' so disable them
DisableEventHandler
End Sub

Sub EnableEventHandler()
Set x.App = Word.Application
End Sub

Sub DisableEventHandler()
Set x.App = Nothing
End Sub
'---
Then, with your mail merge main document open, run the MergeWithEvents
subroutine to run your merge


Peter Jamieson

http://tips.pjmsn.me.uk

On 30/04/2010 06:41, Faisal Ijaz wrote:
I have to sent email messages with mail merge with different subjects. I have
excel sheet which contains subject, email address fields. please help

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
Mail-Merge: Can we have master detail relationship or multiple entities in word Mail-Merge? gmax2006 Microsoft Word Help 1 March 28th 07 06:28 PM
Take Mail Merge in Word back the the Mail Merge Helper 1,2,3 Form. Chris Green Mailmerge 5 October 8th 05 03:51 PM
collate pages in mail merge vs mail merge being single document Dan Schwab Mailmerge 2 September 14th 05 09:35 PM
Medical Students need a word template to study subjects better. Maulik V Baxi, MBBS Microsoft Word Help 1 August 19th 05 03:51 PM
mail merge doc with further linked/embedded mail merge docs not playing the game Rob Cowlard Mailmerge 3 January 8th 05 09:15 AM


All times are GMT +1. The time now is 01:37 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"