Insert records into outlook from Excel.
From Outlook, please add a reference to Excel to your VBA project via
Tools/References. Then you can see Excel's object model in the object
browser (f2) as well.
To open a workbook see Excel.Application.Workbooks.Open. You can access a
single cell with the Range object and move to the next cell with the Offset
function.
Please open the Excel VBA help and see samples for the mentioned methods.
There's different ways to add text to an e-mail template. Easiest approach
might be using placeholders in the e-mail. E.g.: "... interesting text #1
and more..."
Then you can use the replace function to replace #1 by anythign else:
Item.Body = Replace(Item.Body, "#1", "anything else")
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6
Am Thu, 4 Oct 2007 14:22:02 -0700 schrieb Edward:
Hi Everybody,
I have an Excel file with several hundred records as follow
A B
Name Project
Bob a
Bob b
John c
John d
John e
Mike f
. .
As you can see there might be several projects for each person (1 to 30) ,
also I have a standard letter in outlook that I want to email it to each
person and include all the projects he/she has. I want to use use VBA code
to
achive this task any help greatly appriciated .
Note: I can't use mail merge because I don't want to send several emails
to
each person when they have more than one project .
I'm mainly looking for the code to read excel from outlook also insert
those
data in the body text of outlook in a proper paragraph.
|