Send Email VBA

L

lehainam

Dear all,

I have a macro that send data from Excel though Microsoft Outlook:

Sub Mail_With_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strto = Cells(2, 3)
strcc = ""
strbcc = ""
strsub = Cells(2, 1)
strbody = Cells(2, 4)
With OutMail
..To = strto
..CC = strcc
..BCC = strbcc
..Subject = strsub
..Body = strbody
..Send
End With
Application.SendKeys "%S"
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

But there is always a message to confirm your sending by press Yes or
No.

'The program is trying to automatically send an emai on your behalf.
'Do you want to allow this?

Could any one help me to skip this message or to press Yes
automatically when the message popups.

Thanks a lot!

Nam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Send Email 4
Email on value change (Formula) 6
Sending e-mails from specific email address 2
E-mail if Cell B33 = Yes 2
Mail Multiple Sheets via PDF Q 5
EMAIL 1
Converting an Excel file to PDF Q 1
?????? 2

Top