1
I have an excel VBA code, which sends to some specific recipients some e-mail’s, but at first these email as they are being sent by my outlook are coming out with my name, but in Outlook we have the option to type from which name you want to send this e-mail that is the "DE" field. My doubt and, as I put in the code for him to send from another name, through this field "OF", without being by my name? Searching I found the Sender command, but when I use it gives the message "Compile Error - Incompatible Types". Below sege the code line for sending email, can help me please.
Sub Enviar_e_mail()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
'Criação e chamada do Objeto Outlook
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Application.DisplayAlerts = False
With OutMail
.Sender = "[email protected]"
.To = "[email protected]"
'.CC = ""
.BCC = ""
.Subject = "Titulo do e-mail"
.Body = "Texto do E-mail"
'O trecho abaixo anexa a planilha ao e-mail
.Attachments.Add "Arquivo a ser anexado"
.Send
End With