How Email does not need user interaction ?

K

Koulla

Hi I am trying to send email with Microsoft Outlook from Excel using VBA
code!!
Here is my code and is working Perfect

With Application
.EnableEvents = False
.ScreenUpdating = False
End With


Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = "This is a test!" & vbNewLine & _
"Please ignore it"

With OutMail
.To = "xxxxxxxxx"
.CC = ""
.BCC = ""
.Subject = "Here is Counters Alarm file date " & datevar & " and time "
& hourvar & ".XLS"
.Body = strbody
.Attachments.Add (dirvar & "Counters_" & datevar & "_" & hourvar &
".xls")
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")

.send
End With

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing

But my problem is that before sending it it needs a user interaction because
the following message appears from the Microsoft Office Outlook
"A program is trying to automatically send e-mail on your behalf. Do you
want to allow this ? If this is unexpected, it may be a virus and you should
choose "No" "
and the user have to select an option Yes or No. But I dont want this I want
the default option to be YES. How can I do this via my code ??? Or is there
any option in the Microsoft Office Outlook to do it just once ??
Thanks in advance
 
K

Koulla

Hi I just try it but the following error appers
Send using configuration value is invalid
Any help here ??
Thanks
 

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

Top