The following code I grabbed from a couple post here and then and compbined. My goal is two things.
1. Create New Email with template
2. Have From pre populated.
I have been able to do both of the above in individual macros separately. I am having trouble doing both in the same macro. Currently, the template loads but I cannot get the From part.
Here is the code
Sub LoadBackDateTemplate()
Dim NewMail As Outlook.MailItem
Dim objOLApp As Outlook.Application
Set objOLApp = New Outlook.Application
Set newItem = Application.CreateItemFromTemplate("C:\Documents and Settings\XBC5\Application Data\Microsoft\Templates\Security Manager Termination Violation.oft")
Set NewMail = objOLApp.CreateItem(olMailItem)
NewMail.SentOnBehalfOfName = "SYSTEMS.SECURITY"
newItem.Display
Set newItem = Nothing
End Sub
Thanks
1. Create New Email with template
2. Have From pre populated.
I have been able to do both of the above in individual macros separately. I am having trouble doing both in the same macro. Currently, the template loads but I cannot get the From part.
Here is the code
Sub LoadBackDateTemplate()
Dim NewMail As Outlook.MailItem
Dim objOLApp As Outlook.Application
Set objOLApp = New Outlook.Application
Set newItem = Application.CreateItemFromTemplate("C:\Documents and Settings\XBC5\Application Data\Microsoft\Templates\Security Manager Termination Violation.oft")
Set NewMail = objOLApp.CreateItem(olMailItem)
NewMail.SentOnBehalfOfName = "SYSTEMS.SECURITY"
newItem.Display
Set newItem = Nothing
End Sub
Thanks