Outlook Security Popup when sending email via Excel

D_M_K

New Member
Joined
Feb 13, 2015
Messages
3
Hi

I am hoping somebody can help me with my issue.

I have setup a document that opens a CSV file, transfers the data and saves the file in a location but also emails before it closes. however I am getting a pop up I would like to bypass and Application.DisplayAlerts = False doesn't seem to do so.

The popup I am getting is :

Microsoft Outlook

"A program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date."

This has 3 buttons Allow Deny Help

Is there a way I can get this to auto allow through excel?

Many Thanks in advance.

DMK
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi, try the following

Change .Send to .Display and put SendKeys "^{ENTER}" before the With OutMail line.

Or just leave at .Display and the email pops up and you have to press Send manually.
 
Upvote 0
Hi, try the following

Change .Send to .Display and put SendKeys "^{ENTER}" before the With OutMail line.

Or just leave at .Display and the email pops up and you have to press Send manually.


i'm a bit confused as the only .send I have is in the .sendmail and I cant do .displaymail .. This is the code I have:

Windows("Data Collection Form.csv").Activate
ActiveWorkbook.SaveAs Filename:="c:\filepath\DCF_" & _
Format(Now(), "mm_dd_yyyy hh mm"), FileFormat:=xlCSV, Password:="", _
WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.SendMail Recipients:="email@email.com"
Application.DisplayAlerts = False
ActiveWindow.Close
 
Last edited:
Upvote 0
I've just copied the code I use below - but changing .sendmail to display or .displaymail may do the same thing.

Sub sendfile()

On Error GoTo SendMailItemError:

Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(olMailItem)


With objMailItem
.To = "email@email.com"
'.cc =
.Subject = "Test"
.Attachments.Add "C:\test.xls"
.Display
.HTMLBody = "This is a test"
End With


Set objMailItem = Nothing
Set objOutlook = Nothing
Application.StatusBar = False

Exit Sub


SendMailItemError:
MsgBox "Message item could not be sent.", vbCritical, "SendMailItem "


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,291
Messages
6,124,093
Members
449,142
Latest member
championbowler

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top