Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Doing a mail merge from Excel to Outlook

0 views
Skip to first unread message

Nic

unread,
Feb 5, 2001, 8:36:17 AM2/5/01
to
Hi

I have a spreadsheet with email addresses in column A, Subjects in column B
and some text in column C.
I want to use VBA in either Excel 2000 or Outlook 2000 to copy each row in
spreadsheet to emails - for example:
Copy cell A1 to TO field in Outlook
Copy cell B1 to SUBJECT field in Outlook
Copy cell C1 to MESSAGE BODY field in Outlook
Send the mail
Take the next row and do the same

My main problem is not knowing how to address the outlook fields from an
Excel macro

Can anyone help ?

Thanks
Nic


Tim Zych

unread,
Feb 5, 2001, 10:02:05 AM2/5/01
to
This cycles through values in column A, populates Outlook mailitems and
mails them.

Sub CycleNSend()

' Set a reference to
' Outlook object model.

Dim cell As Range
Dim ol As Object
Dim mailitem As Object

Set ol = CreateObject("Outlook.Application")

For Each cell In Worksheets("Sheet1"). _
Range("A:A").SpecialCells(xlTextValues)

Set mailitem = ol.CreateItem(olMailItem)

With mailitem
.To = cell.Value
.Subject = cell.Offset(0, 1).Value
.Body = cell.Offset(0, 2).Value
.Send
End With

Set mailitem = Nothing

Next

Set ol = Nothing

End Sub

"Nic" <nic...@hotmail.com> wrote in message
news:95ma9r$a4t$1...@plutonium.btinternet.com...

0 new messages