Field in Subject Line Mail Merge Using Word 2010

rexhvn

New Member
Joined
Jan 7, 2016
Messages
27
Hi All,

I am hoping for some assistance please. I am wanting to add a data source from my excel spreadsheet into my subject line however I do not have the add on tool for Mail Merge.

Is there any other way I can do it such as VBA code? If so, help would be greatly appreciated.

Thanks,
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I'm trying to customize my subject line based on a cell in my excel document. For example is there is a "Yes" in cell k2, I'd like the subject line to say "hello"

else if the cell J2 says yes then subject line should be "Bye"

I'd also like the cells compared to be the corresponding cells of each row

any suggestion?
I basically still using the code from earlier
 
Upvote 0
You can only have one field (column) in Excel for the Subject line. Each row in that column can be different. I have no idea what you mean by:
I'd also like the cells compared to be the corresponding cells of each row
 
Last edited:
Upvote 0
This perfectly worked where I had a worksheet with the data along with a column with the heading as "Email" as well as another column called "Subject" and I had a concatenate formula in the "Subject" like +CONCATENATE("Re: Your order ",A2, " Placed on ",B2). Then I used the MS Word menu item "MAILINGS" - > "Select Recipients" -> "Use an existing List" then select the Excel document containing the above information and using "Insert Merge Field" from (Write and Insert menu bar) to further customise the message body. I then opened the DEVELOPER tab and went to Macros and clicked on Create and under the Normal project, under Modules, under NewMacros, I selected and removed everything and pasted the below code
Sub Merge_To_Emails()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
For i = 1 To .MailMerge.DataSource.RecordCount
With .MailMerge
.Destination = wdSendToEmail
.SuppressBlankLines = True
With .DataSource
.FirstRecord = i
.LastRecord = i
.ActiveRecord = i
End With
.MailAddressFieldName = "Email"
.MailSubject = .DataSource.DataFields("Subject")
.MailFormat = wdMailFormatHTML
.Execute Pause:=False
End With
Next i
End With
Application.ScreenUpdating = True
End Sub




then to run the macro, I had to go to DEVELOPER and select Macros and select the Merge_To_Emails from the drop down list and off you go.
 
Upvote 0
This perfectly worked where I had a worksheet with the data along with ... I then opened the DEVELOPER tab and went to Macros and clicked on Create and under the Normal project, under Modules, under NewMacros, I selected and removed everything and pasted the below code
As was previously advised - and which you seem to have disregarded, a mailmerge cannot do CCs.

PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top