I have no idea what at [pomt *** is, nothing is indicated. However your
inner loop is setting endFile = 1, then decrementing it, then on the next
pass the loop will fail the endFile test. What is endFile there for anyway?
It seems to serve no useful purpose.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Tommy Geek" wrote in message
...
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