Through all I have received, the following is the code that creates an email to a selected or opened or selected contacts individually using email template form, but when I open the contact from a calendar event, it does not recognize the email address of the contact, and it does not work. So what can we fix right away so when I open a contact from a calendar event or an email I received, this macro will create the email to the contact.
Sub Group_Email_Good_Afternoon()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As mailItem
Dim ObjItem As Object
Set oContact = ObjItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection
For Each ObjItem In objSelection
Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\Form1.oft")
With objMsg
.To = ObjItem.Email1Address & ";" & ObjItem.Email2Address
objMsg.Display
End With
'objMsg.Send
Next
Set objMsg = Nothing
Set ObjItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub
Sub Group_Email_Good_Afternoon()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As mailItem
Dim ObjItem As Object
Set oContact = ObjItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection
For Each ObjItem In objSelection
Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\Form1.oft")
With objMsg
.To = ObjItem.Email1Address & ";" & ObjItem.Email2Address
objMsg.Display
End With
'objMsg.Send
Next
Set objMsg = Nothing
Set ObjItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub