Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Ventouris Tom Ventouris is offline
external usenet poster
 
Posts: 4
Default Mail Merge Subject Line

Thanks. This is exactly what I was looking for

"Peter Jamieson" wrote:

If you are familiar with VBA, you can use Word's MailMerge events and
VBA to specify the subject for each email.
e.g. 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 24/02/2010 07:22, Tom Ventouris wrote:
I have a mail merge with tables in MS Access.
Is there any way to select the subject line on the screen that pops up when
I click Send E Mail Messages from a Field in the merged data?

.

 
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
How do I get something in the email subject line for mail merge? Jill Mailmerge 1 April 17th 08 11:11 PM
how do i set up a E-mail Template for Subject line in Outlook? Clarrus Microsoft Word Help 2 November 9th 06 03:04 PM
How to add a subject line to mails sent thru mail merge Jaga Mailmerge 3 August 21st 06 10:13 AM
Word form field as subject line in an e-mail mcervania Microsoft Word Help 1 January 19th 06 04:33 PM
How do I get a subject line on mail merged emails? Matt_hull1979 Microsoft Word Help 1 October 8th 05 05:37 PM


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