Code not running on "Got Focus"

Leesha
BronzeLounger
Posts: 1489
Joined: 05 Feb 2010, 22:25

Re: Code not running on "Got Focus"

Post by Leesha »

Hi Hans,
This one has reared it's ugly head again. Everything is working fine in the code with the exception that the user noted that not all of the emails are going out. Only the first one is. This is the section of the code that sends out the cc emails. We changed it to being a "Not IsNull" because they were getting errors when the cell didn't contain an email address. I thought that was working fine till they noticed that not everyone was getting their email last month. I tested it and sure enough, only the first recipient is getting the email.
Thanks
Leesha
' Create a new e-mail message
Set outMsg = outApp.CreateItem(0) ' olMailItem
With outMsg
' Use the e-mail address field
'Main Email
arrNames = Split(rst!EMAIL, ",")
For i = 0 To UBound(arrNames)
.Recipients.Add arrNames(i)
Next i

If Not IsNull(rst![ContactEmail]) Then
arrNames = Split(rst![ContactEmail], ",")
For i = 0 To UBound(arrNames)
.Recipients.Add arrNames(i)
Next i
End If

If Not IsNull(rst![Other 1 email]) Then
arrNames = Split(rst![Other 1 email], ",")
For i = 0 To UBound(arrNames)
.Recipients.Add(arrNames(i)).Type = 2
Next i
End If

If Not IsNull(rst![OwnerEmail2]) Then
arrNames = Split(rst![OwnerEmail2], ",")
For i = 0 To UBound(arrNames)
.Recipients.Add(arrNames(i)).Type = 2
Next i
End If

Leesha
BronzeLounger
Posts: 1489
Joined: 05 Feb 2010, 22:25

Re: Code not running on "Got Focus"

Post by Leesha »

Hi Hans,
Not sure if this helps, but the cc's all are in the email that goes out, however the only one that actually gets sent is the first one [email]. All the cc's never actully get send. They are only listed in the original email that [email] gets.
Leesha

Leesha
BronzeLounger
Posts: 1489
Joined: 05 Feb 2010, 22:25

Re: Code not running on "Got Focus"

Post by Leesha »

Thanks for the info!! I appreciate it and hope Han's is having a wonderful time! God only knows he deserves it.

I've been testing all morning and the pattern I've found is if the email address is the same in any of the 4 cells, it only sends one out, which really isn't a show stopper. The group that uses this code is going to send out the emails today (there are about 6000) and see what happens. We've not had issues with emails being blocked due to spam filters since then go out one a time and there max number of addresses in an email is about 10 tops.

Leesha

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Code not running on "Got Focus"

Post by Rudi »

I hope it goes out well... Holding thumbs :smile:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.