Thanks for sharing your code as I have done this type of thing a bit differently and it was cool to see how you're doing it.
Have you tried putting a breakpoint on the send and seeing what the email recipients are and then testing them outside of VBA?
Respectfully,
[RCEmailSigLogo]
Liz Ravenwood
Data Technologies
Interior Systems
Rockwell Collins
1851 So. Pantano Rd, Tucson, AZ 85710 USA
(520) 239-4808
Liz_ravenwood@beaerospace.com<mailto:Liz_ravenwood@beaerospace.com>
rockwellcollins.com<http://www.rockwellcollins.com/>
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of ka0t1c_ang3l
Sent: Wednesday, August 22, 2018 7:46 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] outlook does not recognize one or more names
Hello!
I recently upgraded my Outlook to 2016, and have not noticed an error occurring when I send out reminder emails to my tenants. The error seems to occur in the .Send area of the code. Also, this error only occurs with emails in this format first.middle.last@company.com. Below is the code I am using.
Private Sub RUN_Click()
' Open a recordset on the expiring contracts
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * FROM [INS TBL] WHERE [SEND EMAIL] = True")
' Loop through them all
Do Until rst.EOF
' Make sure we have a valid email
If Not IsNull(rst![VENDOR E-MAIL]) Then
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Create the! Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(rst![VENDOR E-MAIL])
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(rst![E-MAIL])
objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(rst![FINANCE EMAIL])
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
..Subject = "Certificate of Insurance Expire Date Approaching"
.Body = "ATTN: " & " " & rst![CONTACT PERSON] & &! quot; " & _
&n! bsp; "-" & vbCrLf & vbCrLf & "Please be advised that the Certificate of Insurance for " & "" & rst![VENDOR NAME] & " has expired or will expire on " & _
rst![CERTIFICATE EXPIRATION DATE] & _
"." & vbCrLf & vbCrLf & "Please submit renewed Certificate of Insurance as soon as possible. If you have any questions, please contact me. Your cooperation is greatly appreciated." & vbCrLf & vbCrLf & "Thank you." &! vbCrLf & vbCrLf &
..Importance = olImportanceHigh 'High importance
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
..Display
Else
..Save
..Send
End If
End With
Set objOutlook = Nothing
End If
' Get the next one
rst.MoveNext
Loop
' Close out
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Any help on how to resolve this error is greatly appreciated!!!
Thanks!
Kat
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
[Non-text portions of this message have been removed]
Posted by: Liz Ravenwood <Liz_Ravenwood@beaerospace.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar