logo

Directory Mail Merge and then email using Outlook (Microsoft Word)
s k posted at Tuesday, May 19, 2009 7:06 PM

Hi All,

 

I am new to this forum. I couldn't find specific to Outlook group so posting here.

 

I am looking for some help in creating a directory mail merge. I have data in spreadsheet in the following format.

 

Publisher

Books

Email

PubA

Title One

abc@test.com

PubA

Title Two

abc@test.com

PubA

Title Three

abc@test.com

PubB

Book One

xyx@abc.com

PubB

Book Two

xyx@abc.com

PubC

One Volume

mnop@abd.net

PubD

Another Text

email@newemail.com

PubE

First of Many Books

last@last.edu.com

PubE

Second of Many Books

last@last.edu.com

PubE

Third of Many Books

last@last.edu.com

PubE

Last of Many Books

last@last.edu.com

 

I have created a directory mail merge in which I have got one letter for each publisher consisting of books list I need to order. i.e. One letter to PubA with all three titles. My letter varies with publisher according to number of books.

 

The problem I am facing is how to email these letters to just one email Id using outlook.

For example, I want to send my directory mail merge to Publisher PubA just once on his email abc@test.com and not three times as shown in my excel spreadsheet.

 

I have tried merging with new documents and emailing but it mails all 5 letters together to all the emails present in the spreadsheet.

 

I want individual letters to specific recipients only.

 

I hope I have explained my problem. Any feedback or help would be highly appreciated. Thanks in advance.

 

-Aroma

Reply    Reply Using Power Editor
  Rank Winnings Points
February 0 $0.00 0
January 0 $0.00 0
VBA Solution
Rolf Jaeger provided a rated reply to s k on Thursday, May 21, 2009 8:51 PM

Hi there:

I would suggest to run the macro listed below on your worksheet (make sure to set topCell to the cell the first occurrence of PubA is located in (I assumed it might be A2). I have uploaded a workbook that contains both your original sample and the aggregated version: http://www.eggheadcafe.com/fileupload/629396994_BookListAggregation.zip (please note that although the file extension is .zip this is actually an Excel workbook; you'll need to rename it to *.xls before you open it).

Please don't hesitate to contact me if you have any further questions.

Good luck,
Rolf Jaeger
SoarentComputing
http://soarentcomputing.com
510.300.7462

Sub AggregateBooks()
    Dim topCell As Range
    Dim iRow As Integer
    Dim nBooks As Integer
    
    Set topCell = Range("A2")
    
    iRow = 0
    Do
        nBooks = 0
        Do
            topCell.Offset(iRow + nBooks, 0).Select
            If topCell.Offset(iRow + nBooks + 1, 0).Value <> topCell.Offset(iRow + nBooks, 0).Value Then Exit Do
            topCell.Offset(iRow, 1).Value = topCell.Offset(iRow, 1).Value & Chr(10) & topCell.Offset(iRow + nBooks + 1, 1)
            nBooks = nBooks + 1
        Loop
        iRow = iRow + 1
        If nBooks > 0 Then
            Rows(iRow + 1 & ":" & iRow + nBooks).Select
            Selection.Delete
        End If
        If topCell.Offset(iRow, 0).Value = "" Then Exit Do
    Loop
End Sub
Reply    Reply Using Power Editor
PhD in physics, Technical University Munich, Germany. Over 20 years of technical management experience at Hewlett-Packard and Agilent Technologies. Programming expertise: - VB.NET - C# - ASP.NET - Excel VBA
  Rank Winnings Points
February 6 $51.00 63
January 13 $20.00 73


Didn't Find The Answer You Were Looking For?

EggHeadCafe has experts online right now that may know the answer to your question.  We pay them a bonus for answering as many questions as they can.  So, why not help them and yourself by becoming a member (free) and ask them your question right now?
Ask Question In Live Forum

If you have an OpenID and do not want to become a member of the EggHeadCafe forum, you can also sign on to Chat Chaos and post your question to our real time Silverlight chat application.
Ask Question In Chat Chaos










  $1000 Contest    [)ia6l0 iii - $228  |  Jonathan VH - $161  |  Huggy Bear - $135  |  F Cali - $95  |  egg egg - $94  |  more Advertise  |  Privacy  |   (c) 2010