• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

API to bypass Outlook email send warning (Excel VBA

Status
Not open for further replies.

ajay_1151

New Member
Hi there,
Looking for some help. A macro is written in Excel VBA to send email through Outlook. I am getting an error, "A program is trying to send email on your behalf". What I am looking for is, this popup message should not popup. Email should be sent without any alert or warning. Please note that this macro will run on multiple systems where Outlook 365 is installed. In outlook 365, there are restrictions to do any changes in Outlook Trust Center settings also can't change anything in Windows registry. Also can't use CDO email method as there are restrictions to get SMTP Port details. Please help. I am using below code.

Code:
Sub send_email()
application.displayalerts = false
dim outapp as object
Dim outmail as object
Set outapp = createobject("outlook.application")
with outmail
.To = ""
.cc = ""
.body ""
.send
End with
Set outmail = nothing
Set outapp = nothing
Application.displayalerts = True
end sub

securitywarning.gif
 
Last edited by a moderator:
ajay_need_help
Why do You try to 'send' email
... without any address
... without any subject
... without any body ?
Hi there. Sending email to one of my Organisation email address which I can't mention here, same with Subject line and email body, it contains some sensitive information. That's the reason I have kept it blank. If you put your email address in .To field, you we will receive an email, however my concern is to bypass the Outlook warning message.
 
ajay_need_help
Seems that You have pasted text here, which isn't VBA-code.
Nobody needs correct data here, but Your 'code' should even look like useful.
There seems to be same words, which I have used in my code (except Application.DisplayAlerts),
BUT ... lucky, I don't use (and cannot use) 'Outlook' ( I cannot test this at all)
BUT ... also, I haven't got any feedback from user about any warning messages.
Have You checked Your Outlook-settings, is there something ...?
 
ajay_need_help
Seems that You have pasted text here, which isn't VBA-code.
Nobody needs correct data here, but Your 'code' should even look like useful.
There seems to be same words, which I have used in my code (except Application.DisplayAlerts),
BUT ... lucky, I don't use (and cannot use) 'Outlook' ( I cannot test this at all)
BUT ... also, I haven't got any feedback from user about any warning messages.
Have You checked Your Outlook-settings, is there something ...?
Hi there, trust me, this is a VBA code and it is perfectly working fine, not just for me but everyone in my organisation. Sad that you can't use outlook, so you can't test it. The warning message is correlated with the Outlook Trust Center settings and the Antivirus installed on the machines. I am looking for API which will bypass the Outlook warning message from appearing on the screen.
 
ajay_need_help
It would always better to use 'real code' which has 'cleaned'.

I'm happy that I cannot use the Outlook and
as I also wrote that neither other have not given feedback about any messages.

Have You tried to Application.EnableEvents ?
... before set to False ... and after have to set back to True !

Of course You have checked all next:
 
ajay_need_help
It would always better to use 'real code' which has 'cleaned'.

I'm happy that I cannot use the Outlook and
as I also wrote that neither other have not given feedback about any messages.

Have You tried to Application.EnableEvents ?
... before set to False ... and after have to set back to True !

Of course You have checked all next:
Vletm :
The code is real, when I said it is working for me and for others too, it suggests the same too.

I have already tried everything which you mentioned here. Trust me, I have Google everything related to it.

I am looking for API which will bypass the Outlook warning.

Can you please help me with the API?
 
ajay_need_help
No, I don't have no more ideas this Outlook, which I do not use, sorry.

One last link has text as:
OlSecurityManager.DisableOOMWarnings = True
and later back to False
 
Status
Not open for further replies.
Back
Top