I want o send an email from excel but I have to open the outlook otherwise the mail is not sent. Why the command oEmail.Send doesn't work. Any idea?
Here is my code
Dim oApp As Outlook.Application
Dim oEmail As MailItem
Dim colAttach As Outlook.Attachments
Dim oAttach As Outlook.Attachment
Set oApp = CreateObject("Outlook.Application")
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.HTMLBody = "ola" & "<img src=""c:\senhora.jpg"" > " & vbNewLine
oEmail.Save
oEmail.Display
oEmail.To = "myemail"
oEmail.Subject = "Teste ao envio de email"
oEmail.Send
Set oEmail = Nothing
Set colAttach = Nothing
Set oAttach = Nothing
Set oApp = Nothing
Bookmarks