Direct email with Address Book Excel

Source: Internet
Author: User
Tags rowcount

The author is using a friend email address of the Excel file automatically send e-mail to relatives and friends, this method is not only convenient and quick, and these messages to the recipient, subject, content, accessories are not the same.

First, the establishment of friends and relatives directory

Create a list of friends and relatives in your worksheet that contains different recipients, topics, content, and attachments.

II. using macros to automate e-mail delivery

Open the tools → macros →visual basic Editor, click insert → module to insert a module, double-click the inserted module in the Engineering window, open its Code window, and enter the following macro:

Sub automatic Send mail ()

"To be able to send correctly and require an effective configuration of microseft outlook

On Error Resume Next

Dim RowCount, Endrowno

Dim Objoutlook as New outlook.application

Dim objmail as MailItem

"Gets the number of rows of data area connected to the current worksheet and cells (1,1)

Endrowno = Cells (1, 1). CurrentRegion.Rows.Count

"Create Objoutlook as Outlook Application object

Set Objoutlook = New Outlook.Application

"Start the loop to send e-mail

For rowcount = 2 to Endrowno

"Create Objmail as a mail object

Set objmail = Objoutlook.createitem (olMailItem)

With objmail

"Set the recipient address (obtained from the e-mail address field of the Address Book table)

. to = Cells (rowcount, 2)

"Set the message subject

. Subject = "Good New Year!" [Greetings from a friend of the people] "

"Set the content of the message (obtained from the Content field in the Address Book table)

. BODY = Cells (rowcount, 3)

"Set attachments (obtained from the Attachment field in the Address Book table)

. Attachments.Add Cells (ROWCOUNT, 4)

"Send messages automatically

. Send

End With

"Destroy the Objmail object

Set objmail = Nothing

Next

"Destroy the Objoutlook object

Set Objoutlook = Nothing

"Prompt when all e-mail is sent complete

MsgBox rowCount-1 && "a friend's greeting letter sent successfully!"

End Sub

The above code is passed in Excel 2000, and the "Address Book" and "Fully automated mail" macro code are slightly modified to deliver a large number of messages in any form.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.