Emailing multiple recipients

Cjaye

Board Regular
Joined
Nov 26, 2008
Messages
55
This is a call to any VB experts out there who wouldn't mind taking a look at my vb code to check for any foreseeable problems. My macro appears to be accomplishing what I want it to do and at this point
the whole process is running smoothly. My concerns are that my code may not be as efficient (for speed) as it could be and that I'm missing code to manage any potential problems (i.e. error handling in the
proper places). I've tested the whole process by sending about 60 email notifications to a couple of my email own addresses and it took about 3-4 minutes which is probably ok)

Although I'm not looking for any major rework, any tips/tricks would really be appreciated.

To summarize my project:
I was tasked to automate our Transportation Dept's vehicle mileage notification process. Each month, commands are required to submit their current vehicle mileages and When they fail to do so, a
notification is emailed to them via Lotus Notes with an attached Excel file. The attachment lists their vehicles missing the current mileage. The process starts by clicking on a GSA Mileage Notification
button on the GSA Mileage Report.xls spreadsheet, used for tracking all the vehicle information. A dialog box then pops up prompting the user to select 1st, 2nd, or 3rd notification (used for the email
subject line only).

In the GSA Mileage Report.xls spreadsheet are two sheets; the Main sheet that holds all the vehicle information (veh#,previous & current mileages,commands,POCs(point of contacts), other misc info, and a
column named "Send Notification?" coded (on the spreadsheet) to show a "YES" if the current mileage is missing and a "NO" if it is not missing). The second sheet is named MailInfo and holds all the POC
names in one column and their email address or Lotus group name in another column. If there are more than one POC/email address per vehicle, a group is created in Lotus Notes. There are approx 450 rows
(vehicles) and on average, about 50-70 notifications have to be sent out at a time. Note: There is a "Click to Update" button and a "Report Status" column with some code in the cells that came with the
spreadsheet and is not part of my macro/process nor does it interfere with it.

In the macro code, AdvancedFilter is used to filter and copy the unique POCs to a temporary worksheet(POCSheet) for those rows that have a "YES" in the "Send Notification?" column. The POCSheet is used in
conjunction with a Vlookup function to get the email address or Lotus group name from the MailInfo sheet. An AutoFilter is used to filter the data I want to email based on the unique POCs from the POCSheet
and the "Send Notification?" column being "YES". A workbook(EmailWB) is created to hold the filtered data and is emailed to the recipient(s). A workbook(FileWB) is created to hold a copy (for storage) of all
the worksheets emailed out for each notification period.

I am new to VB and I did quite a bit of forum reading and borrowing of code (mostly from Ron de Bruin excellent samples) so some code might be miss-used and/or useless to my needs.

I've provided (I hope) a simplified snapshot of the spreadsheet and my code below.

I am using Excel 2003

Thank you in advanced for any insight you can provide.<SCRIPT language=JavaScript src="http://www.interq.or.jp/sun/puremis... Set noSession = Nothing End Sub [/CODE]
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Thanks for the reply. Did I mention that the whole process works pretty good? and so...maybe you can elaborate on where and why you think it's messed up.

Catherine
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top