Вы находитесь на странице: 1из 7

VBA Email From Excel

I created the layout of Excel workbook for sending emails from Excel to various email addresses. I need the VBA to make it all work Specifically, each workbook will have one email sending account Assigned to it and all the necessary settings (username, password, etc) On another sheet there will be a list of email address On another sheet will be the email bodies and subject lines I will need the email bodies and subject lines and URLs to be able to randomly rotate before sending the email out.

Page 1 (dashboard)
Control panel for this program

Buttons will start, pause or stop the process. Started = Date and Time (now()) when I click the start button

Last Run = the date and time the last time the program ran successfully Total Emails in Lists = =COUNTA(Emails!A2:A550) Delays Min = minimum number of seconds between email being sent Max = Max number of seconds **The VBA will select a random number of seconds between these two numbers for the next email. If the settings is as they are in the screen shot then one email may be sent then the next one will be delayed 18 seconds before the next and the one after that might be 5 seconds. I want this to be a random selection independent of each other email sent between these to delay settings

Progress
Sent = running total sent this session Pending = =sum(F10-C7) Test email is an email that I can use to send a test email from this application to that email to make sure it is working and configured correctly.

Page 2 (Structure)

Account
Email account info for sending email

URL
List of URLS that will be randomly picked for each email sent. The URL will be inserted into the body with %URL% tags (not case sensitive). It will pick from the list provided. If there is only 3 URLS then it will randomly pick from these 3. If 5 then it will randomly pick from the five.

Subject
List of Subjects that will be randomly picked for each email sent. The Subjects will be inserted into the Subject line of the email. It will pick from the list provided. If there is only 3 Subjects then it will randomly pick from these 3. If 5 then it will randomly pick from the five.

Body
On the left is the number in this example you see body number 1 but there are a total of 5. Within the body I will type and format the email message. I will use the %URL% tag to insert the randomly selected URL. So within this body I will use bold and underline and different fonts which will be sent to the email recipient as formatted.

Test Button
Same function as the Test button on the Dashboard page

Page 3 (Emails)
Row 1 are titles Row 2 column A is a list of individual email address which this program will mail to. Column B each to next record will record the date and time the email was sent (I use this info in another program for tracking) A simple now() is sufficient. But each record will have a different time since this program may run over a few hours. This is not an email blast program but rather a slow and random light weight program.

Page 4 (Settings)
Any settings needed for the program to operate including the test email template.

Typical use of the program.


I will open the program make any changes, if any, to the subject, body, etc then click send and leave it alone. Very simple and direct. It will go down the list of email addresses and send out emails until it reaches the end of the list and then stop.

Notes:
While the program runs I do not want it locked. I want to be able to resize, scroll, minimize without any issues. I hate programs that lock things up until it is finished. I will have multiple installs of these programs which each one will be configured with separate settings and information. One running must not interfere with another one running.

This will need to be written in Excel 2007 and run on a Windows 7 or XP OS. Any warning boxes with emailing from this excel program must be suppressed. All coding shall be open and not locked or password protected. I want to see everything nothing hidden. All code must be well commented on in English so I understand the blocks, process, etc. Great learning experience

Вам также может понравиться