PDA

View Full Version : Mail Merge with Custom Subject



Chip
04-14-2006, 07:49 AM
Hey everyone,

I don't have much experience with VBA in Word. I've used it a little in Excel but I'm hoping someone here will be able to help me. I would like to use the Mail Merge in Word to send emails that have a field from the data source in the subject line.

Is there an easy way to do that without recreating the wheel? I used the search and saw that some people have accomplished this in some code they wrote. I also know there are some programs for sale for ~$25 that can do it but I wanted to see if anyone here had a simple or free solution to my need first. : pray2:

Thanks in advance for any help.


</IMG>

lucas
04-14-2006, 10:06 AM
Did a quick search of the forum and found this which adds the first line of the doc to the subject.....outlook.

Option Explicit
Sub MyOutlook()
Dim AppOutlook As Object
Set AppOutlook = CreateObject("Outlook.application")
With AppOutlook.CreateItem(olMailItem)
.To = "Anyone@home.com"
.Subject = ActiveDocument.Sentences(1).Text
' .Send
.Display
End With
Set AppOutlook = Nothing
End Sub

Chip
04-14-2006, 10:50 AM
Thanks lucas(Steve?) for your replay. I think having the first line of the email be the subject would work. I'm just not sure how to encorporate the code you found with the mail merge process to get this to happen for all the e-mails that will be sent. Thanks for your suggestions.

lucas
04-14-2006, 11:20 AM
I'm not much help in Word, mailmerge, etc. someone will come along with better answers for you soon.

If you can use access I might have an idea.....