mdmackillop
05-25-2012, 04:40 AM
Using this as the basic code, I wan't to add a different email address to the "From" field in a new email. I can't locate the property for this.
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Please enter the message text here. </BODY></HTML>"
'@@@@@@@@@@@@@@@@@@@@@@
.From = "This fails here"
.Display
End With
End Sub
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Please enter the message text here. </BODY></HTML>"
'@@@@@@@@@@@@@@@@@@@@@@
.From = "This fails here"
.Display
End With
End Sub