Add a from email statement so it appears in the From of the email

I want to add a ".From" in my Excel VBA application but it is not supported.
How do I add a from email statement so it appears in the From of the email?
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.From = "[email protected]"
.To = "nameto2@email,com" .Subject = "We have moved!!!"
.HTMLBody = "<html><body bgcolor='#999955'>text</body></html>"
.Display
'.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing

The Sender-related properties don't make any sense for new emails. For a full list of MailItem properties take a look at the
MailItem class in MSDN.
It looks like you are interested in the SendUsingAccount property of the MailItem class which allows to set
an Account object
that represents the account under which the MailItem is
to be sent. 
Sub SendUsingAccount()
Dim oAccount As Outlook.account
For Each oAccount In Application.Session.Accounts
If oAccount.AccountType = olPop3 Then
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = "Sent using POP3 Account"
oMail.Recipients.Add ("[email protected]")
oMail.Recipients.ResolveAll
oMail.SendUsingAccount = oAccount
oMail.Send
End If
Next
End Sub

Similar Messages

Maybe you are looking for