# Merge field in the subject line of a Word e-mail mail merge



## Orcagal (Nov 4, 2014)

Hi, 

I use Word 2007 for an e-mail mail merge to create personalised invoices. The source data comes from Excel 2007, with fields such as "Contact name" "Firm name" and "month"

While the whole process now runs largely smoothly, one thing bugs me...when I come to send the mail messages, there is no option to insert a merge field into the subject line of the dialogue box that appears, so I have to make do with a generic subject line.

This is both impersonal to the firm, and makes it harder to find a particular invoice once they are saved.

I want to be able to create a personalised Subject line to the effect of

Charges Statement <Month> <Firm>

with the Month and Firm being merge fields.

Is there a simple way around this please? I don't know VBA code or anything like that.

Thanks

Dawn


----------



## lomax (Nov 4, 2014)

I dont know much about mail merge or VBA but do use Excel to generate an email and use values within cells of the Workbook.

The code below is self explanatory i.e. It picks the recipient from one cell, subject from another, main body text etc...

I guess you would need to learn basic VBA on how to make a macro so you can copy this code into it and then add a button on your sheet to generate the email. Its pretty easy if you have a quick search online. Ron DeBruin has some good info on his site.


```
Sub

'Open email
        
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
        .To = (ActiveSheet.Range("C22").Value)
        .CC = ""
        .BCC = ""
        .Subject = (ActiveSheet.Range("A28").Value)
        .Body = (ActiveSheet.Range("C30").Value)
        .Attachments.Add PDF_Name
        .Display   'or use .Send
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

EndSub
```


----------

