merlynsdad
Programmer
I'm trying to send automated email from Access 2003 via Outlook 2003 SP3. I know there's a problem with Outlook's security that pops up 4 user intimidating messages. I'm using the following code, and wondering if I put a SendKeys command in, would it solve this problem.
If the square peg won't fit in the round hole, sand off the corners.
Code:
Public Sub SendEMail()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim EnterKey As String
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
DoCmd.SetWarnings False
Set objOutlookRecip = .Recipients.Add("recipient@company.com")
objOutlookRecip.Type = olTo
.Subject = "Notification"
.Body = "This is a test."
.Importance = olImportanceNormal 'Normal importance
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
DoCmd.SetWarnings True
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
End Sub
If the square peg won't fit in the round hole, sand off the corners.