From: Faisal Ijaz on 30 Apr 2010 01:41 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
From: Doug Robbins - Word MVP on 30 Apr 2010 02:28 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/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, originally posted via msnews.microsoft.com "Faisal Ijaz" <FaisalIjaz(a)discussions.microsoft.com> wrote in message news:6C63BC0A-C9A8-414B-A5AE-CE2A191F566D(a)microsoft.com... > 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
From: Peter Jamieson on 30 Apr 2010 02:42 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(strSubjectFieldName).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
|
Pages: 1 Prev: REOVE ALL HYPERLINKS Next: How to protect the footnote with password? |