search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

Web ProgrammingArticlesForumsFAQs
JavaScript
ASP
ASP.NET
Web Services

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Operating SystemsArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

View Other Microsoft Word Posts   Ask New Question 
Directory Mail Merge and then email using Outlook
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


 
  VBA Solution
Rolf Jaeger replied to s k at 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