I have to following codes to automate email distribution. Tne email list is an excel file. But everytime a new email is created and to be sent, a screen saying "A program is trying to send email automatically on your behalf. Do you want to allow this?"pops up. But when you are sending 500 emails, you do not want to click "yes" every time. Can some help me to include a code in the body to eliminate this screen or select "yes" automatically?
Dim sht As Worksheet
Dim FirstRow As Integer
Dim LastRow As Integer
Dim SendTo As String, Esubject As String, Ebody As String
Dim MonOutlook As Object
Dim MonMessage As Object
Set sht = Worksheets("Sheet1"
FirstRow = 2
LastRow = 4
For x = 2 To 4
Set MonOutlook = CreateObject("Outlook.Application"
Set MonMessage = MonOutlook.createitem(0)
Ebody = sht.Range("F" & x).Value
Esubject = sht.Range("E" & x).Value
SendTo = sht.Range("D" & x).Value
NewFileName = sht.Range("G" & x).Value
MonMessage.To = SendTo
MonMessage.Subject = Esubject
MonMessage.body = Ebody
MonMessage.Attachments.Add (NewFileName)
MonMessage.send
Set MonOutlook = Nothing
Set MonMessage = Nothing
Next x
End Sub
Dim sht As Worksheet
Dim FirstRow As Integer
Dim LastRow As Integer
Dim SendTo As String, Esubject As String, Ebody As String
Dim MonOutlook As Object
Dim MonMessage As Object
Set sht = Worksheets("Sheet1"
FirstRow = 2
LastRow = 4
For x = 2 To 4
Set MonOutlook = CreateObject("Outlook.Application"
Set MonMessage = MonOutlook.createitem(0)
Ebody = sht.Range("F" & x).Value
Esubject = sht.Range("E" & x).Value
SendTo = sht.Range("D" & x).Value
NewFileName = sht.Range("G" & x).Value
MonMessage.To = SendTo
MonMessage.Subject = Esubject
MonMessage.body = Ebody
MonMessage.Attachments.Add (NewFileName)
MonMessage.send
Set MonOutlook = Nothing
Set MonMessage = Nothing
Next x
End Sub