Hi, I need to send multiple emails to different addresses automatically, but when VBA
starts the send process it opens an alert box asking for my permission to complete the task.
Does anyone know how to override this alert and send the email?
The email sending code:
Function Enviar_dados_celulas_email(subject As String, destiny As String, body As Range, introductin As String)
' selecão da planilha desejada.
If destiny <> "" Then
body.Select
ActiveWorkbook.EnvelopeVisible = True
End If
With ActiveSheet.MailEnvelope
.Introduction = introductin
.Item.To = destiny
.Item.subject = subject
.Item.Send
End With
[D1].Select
End Function
I have this other way, but I can not send a range in the corppo of the email D:
Function Enviar_dados_celulas_email(subject As String, destiny As String, body As Range, introduction As String)
Dim oOutlookApp As Object, oOutlookMessage As Object
Set oOutlookApp = CreateObject("Outlook.Application")
Set oOutlookMessage = oOutlookApp.CreateItem(0)
With oOutlookMessage
.subject = subject
.To = destiny
.body = body
.Display
SendKeys "%e"
End With
Set objMsg = Nothing
End Function