J
Jeff
All,
For all, including myself, who gets this message when
trying to send an Email through code to Outlook:
"A program is trying to automatically send e-mail on
your behalf".
"Do you want to Allow this ?"
It makes you wait & then you HAVE to hit the Yes
button for it to send the Email.
I found a solution. I have seen many posts including one
I put yesterday on how to avoid this & no one was able to
get an answer. I found someone at work who knew...
I found a SOLUTION, it works perfect for me.
Use this code...
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)
EmailAddr = "(e-mail address removed)"
CopyEmailAddr = "(e-mail address removed)"
Subj = "Test subjject"
Body = "Body"
PathName = "C:\test.txt"
With objMail
.To = EmailAddr
.cc = CopyEmailAddr
.Subject = Subj
.Body = Body
.NoAging = True
.Attachments.Add PathName
.Display
End With
'****** Send the email without prompts *******
SendKeys "%{s}", True
'****************************************************
Set objMail = Nothing
Set objOutlook = Nothing
Regards,
Jeff
For all, including myself, who gets this message when
trying to send an Email through code to Outlook:
"A program is trying to automatically send e-mail on
your behalf".
"Do you want to Allow this ?"
It makes you wait & then you HAVE to hit the Yes
button for it to send the Email.
I found a solution. I have seen many posts including one
I put yesterday on how to avoid this & no one was able to
get an answer. I found someone at work who knew...
I found a SOLUTION, it works perfect for me.
Use this code...
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)
EmailAddr = "(e-mail address removed)"
CopyEmailAddr = "(e-mail address removed)"
Subj = "Test subjject"
Body = "Body"
PathName = "C:\test.txt"
With objMail
.To = EmailAddr
.cc = CopyEmailAddr
.Subject = Subj
.Body = Body
.NoAging = True
.Attachments.Add PathName
.Display
End With
'****** Send the email without prompts *******
SendKeys "%{s}", True
'****************************************************
Set objMail = Nothing
Set objOutlook = Nothing
Regards,
Jeff