Read email list send to each on list same formated in outlook 200.
Here is my code, however it stops (at [pomt ***) on the second pass and only
send to on email address.
Public Sub EmailNewCustomers()
Dim endFile As Integer
Dim emailAddress As String
Dim myMail As Outlook.MailItem
Set myMail = Application.CreateItem(olMailItem)
Dim cusEmailAddress As String
Open "C:\Documents and Settings\Administrator\My Documents\TESTFILE1.txt"
For Input As #1
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, cusEmailAddress
endFile = 1
If emailAddress = "EOF" Then endFile = 0
Do While endFile = 1
endFile = endFile - 1
With myMail
.To = cusEmailAddress
.Subject = "New! Weight Loss and Natural Lifestyle Book"
.Body = "New! Weight Loss and Natural Lifestyle Book."
.Attachments.Add "C:\Documents and Settings\Administrator\My
Documents\1-sync\a-before and after\before and after.pdf", olByValue, 1
End With
myMail.Send
Debug.Print cusEmailAddress ' Print to the Immediate window.
Loop
Loop
Close #1 ' Close file.
Const cstrProcedure = "emailer_test"
On Error GoTo HandleError
HandleExit:
Exit Sub
HandleError:
ErrorHandle Err, Erl(), cstrModule & "." & cstrProcedure
Resume HandleExit
End Sub
|