View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Brettjg Brettjg is offline
external usenet poster
 
Posts: 295
Default auto email generator

Hello out there
I'm using the following code which works really well except that each time
it loops around it keeps adding the next attachment. What I want it to do is
to send one email with the first attachment, then send the second email with
the second attachment (only) etc.

I did try deleting the .Add but it didn't make any difference.

Also, can I stop it from sending the pictures in my signature as separate
attachments?

Sub Send_LOAN_APPS()
Application.ScreenUpdating = False
Range("email.app.number").Value = 1

Do While Range("email.app.number").Value <= Range("Number.apps").Value
If Range("email.app.number").Value = 1 Then
Range("Pth.to.send").Value = Range("Pth.APP1").Value
ElseIf Range("email.app.number").Value = 2 Then
Range("Pth.to.send").Value = Range("Pth.APP2").Value
ElseIf Range("email.app.number").Value = 3 Then
Range("Pth.to.send").Value = Range("Pth.APP3").Value
ElseIf Range("email.app.number").Value = 4 Then
Range("Pth.to.send").Value = Range("Pth.APP4").Value
ElseIf Range("email.app.number").Value = 5 Then
Range("Pth.to.send").Value = Range("Pth.APP5").Value
End If

ActiveSheet.Range("Print_Area").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = ""
.Item.To = Sheets("LOAN APPS").Range("email.address").Value
.Item.Subject = Sheets("LOAN APPS").Range("email.subject").Value
.Item.Importance = 2
.Item.ReadReceiptRequested = True
.Item.Attachments.Add Range("Pth.to.send").Value
.Item.Send
End With
Range("email.app.number").Value = Range("email.app.number").Value + 1
Loop

Application.ScreenUpdating = True
End Sub


Regards, Brett